bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17865: 24.3.92; encode-coding-string returns 1


From: Eli Zaretskii
Subject: bug#17865: 24.3.92; encode-coding-string returns 1
Date: Sat, 28 Jun 2014 10:00:40 +0300

> From:  Leo Liu <address@hidden>
> Cc: address@hidden
> Date: Sat, 28 Jun 2014 07:56:53 +0800
> 
> On 2014-06-27 23:15 +0300, Eli Zaretskii wrote:
> > Not a bug: you inserted one character.
> 
> But without `(set-buffer-multibyte nil)' you get 3. Normal?

Yes, because then you insert 3 multibyte characters that represent 3
8-bit bytes.

The value you get counts characters produced by the encoding.  How to
count characters in a unibyte buffer is a question that has no easy
answers.

If, after all this, you will conclude that the return value is not
very useful for high-level programming, I will agree with you.  The
return value is set up to provide what some internal use cases need,
and that's it.  It just returns some member of the structure used to
convert the string; how that member is computed is an implementation
detail that rarely, if at all, is exposed to Lisp applications.

It could be that the return value of 1 in a unibyte buffer was never
bumped into before, and thus never scrutinized.  It could also be that
some Lisp application actually needs that value to be 1.

What is the real-life use case behind this?  Maybe if we talk in the
context of that use case, the discussion will be more meaningful.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]