emacs-devel
[Top][All Lists]
Advanced

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

Re: master 28bf387: Tweak Fdirectory_append for efficiency


From: Eli Zaretskii
Subject: Re: master 28bf387: Tweak Fdirectory_append for efficiency
Date: Sat, 24 Jul 2021 20:13:15 +0300

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: emacs-devel@gnu.org
> Date: Sat, 24 Jul 2021 19:05:20 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > The only cases that make sense to me are:
> >
> >   . all the strings are multibyte
> >   . some of the strings are multibyte, and some unibyte and pure-ASCII
> >   . all the strings are unibyte
> >
> > The last case can happen when we call this function very early during
> > the startup process, before we set up the file-encoding stuff, and
> > thus all the file names are unibyte strings.
> 
> I don't understand your point here, I'm afraid.
> 
> Whenever there's
> 
> (multibyte-string-p "/tmp")
> => nil
> 
> (multibyte-string-p "bár")
> => t
> 
> Why shouldn't I be able to run
> 
> (directory-append "/tmp" "bár")
> => "/tmp/bár"
> 
> without caring about multibytedness?  This is just a string manipulation
> function (geared towards file names).

You should indeed be able to do that, that's my case #2.  The case
that doesn't have to work and doesn't make sense is this

  (multibyte-string-p (encode-coding-string "bár" 'latin-1))
  => nil

  (multibyte-string-p "/tmp/bár")
  => t

  (directory-append "/tmp/bár" (encode-coding-string "bár" 'latin-1))
  => "/tmp/b\303\241r/b\341r"



reply via email to

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