[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte b
From: |
Eli Zaretskii |
Subject: |
Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer |
Date: |
Tue, 28 May 2019 18:18:07 +0300 |
> From: Stefan Monnier <address@hidden>
> Cc: address@hidden
> Date: Tue, 28 May 2019 07:55:40 -0400
>
> >> Hence according to my reading of the code, this call to
> >> string-as-unibyte will always just return its argument unchanged.
> > That's not entirely true, because encode-coding-char can return a multibyte
> > string.
>
> That's weird. When would that happen?
"Use the source, Luke!"
(let* ((str1 (string-as-multibyte (string char)))
(str2 (string-as-multibyte (string char char)))
(found (find-coding-systems-string str1))
enc1 enc2 i1 i2)
(if (and (consp found)
(eq (car found) 'undecided))
str1 <<<<<<<<<<<<<<<<<<<<<<<<<
If we return here, the value is str1, which is a multibyte string, see
how it was calculated.
The easiest use case is this:
(multibyte-string-p (encode-coding-char ?a 'utf-8))
=> t
I didn't think enough about this to figure out if there can be less
trivial use cases. If you can describe all the cases where
find-coding-systems-string will return a list whose 'car' is
'undecided', my hat off to you.
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, (continued)
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Stefan Monnier, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Robert Pluim, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Stefan Monnier, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Robert Pluim, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Eli Zaretskii, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Robert Pluim, 2019/05/28
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Eli Zaretskii, 2019/05/28
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Stefan Monnier, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Eli Zaretskii, 2019/05/28
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Stefan Monnier, 2019/05/28
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer,
Eli Zaretskii <=
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Stefan Monnier, 2019/05/28
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Eli Zaretskii, 2019/05/28
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Eli Zaretskii, 2019/05/28
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Stefan Monnier, 2019/05/28
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Eli Zaretskii, 2019/05/29
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Eli Zaretskii, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Stefan Monnier, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Eli Zaretskii, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Stefan Monnier, 2019/05/27
- Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer, Eli Zaretskii, 2019/05/28