[Top][All Lists]

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

Re: char-to-string

From: Kenichi Handa
Subject: Re: char-to-string
Date: Fri, 9 Feb 2001 17:16:59 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.0.97 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

"Eli Zaretskii" <address@hidden> writes:
>>  ShengHuo ZHU <address@hidden> writes:
>>  > [1  <text/plain (7bit)>]
>>  > (multibyte-string-p (char-to-string ?\200)) returns t, but in Emacs 20
>>  > it returns nil.  This is annoying.  For example, I think programmers
>>  > prefer that (mapconcat 'char-to-string '(?\200 ?\343) "") returns
>>  > "\200\343".  The attached patch fixes this.  Thoughts?
>>  Thank you for the report and patch.  I agree with you.
>>  Especially, there's no reason to have the different behavior
>>  than Emacs 20.
>>  I've just installed the attached change.  
>>    (string ?\200 ?\343)
>>  should also return a unibyte string.

> Such changes so close to a release make me nervous.  Isn't
> it dangerous to introduce them at this time?

I also considered the potential danger on this change.  But,
my conclusion was that it doesn't make the current situation
worse.  Actually, this change makes 21 behaves more
similarly as 20.

> Won't this have potentialy bad effects on eight-bit-*
> character support, e.g. when searching for them in a
> buffer?

Do you have in your mind some concrete example?

Provided that we have \200\343 in a multibyte buffer.
Before the change, to search for it, we had to do:
  (let ((x "\343\200"))
    (search-forward (string-as-multibyte x)))
But, if x is made as this:
  (let ((x (mapconcat 'char-to-string '(?\200 ?\343) "")))
the same search failed.   Instead, we had to do:
    (search-forward (string-as-multibyte (string-make-unibyte x)))

I think all of these should produce the same lisp string:
  (concat "\200" "\343")
  (concat (char-to-string ?\200) (char-to-string ?\343))
  (concat '(?\200 ?\343))
  (string ?\200 ?\343)
  (mapconcat 'char-to-string '(?\200 ?\343) "")
and should work the same way on inserting, searchihg, etc.

Ken'ichi HANDA

reply via email to

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