Subject: 回复:Re: bug#21087: 24.5; ff-find-other-file will create a file with an extra trailling backslash

From: ".." <[email-masked]>
Date: Sun, 19 Jul 2015 10:44:01 +0800 (CST)

Hi Eli,

Yes, you are right, then why it calls read-directory-name with default-name as the DEFAULT-DIRNAME parameter while default-name is actually the name of the file to find. And the patch will come to this:

--- emacs\share\emacs\24.5\lisp\find-file.el
+++ emacs\share\emacs\24.5\lisp\find-file.el
@@ -497,7 +497,7 @@
                   (expand-file-name
                    (read-directory-name
                     (format "Find or create %s in: " default-name)
-                    default-directory default-name nil)))
+                    default-directory)))
 
             (setq pathname
                   (if (file-directory-p name)

At 2015-07-19 01:40:52, "Eli Zaretskii" <[email-masked]> wrote:
>> Date: Sat, 18 Jul 2015 23:47:15 +0800 (CST)
>> From: ".." <[email-masked]>
>> 
>> It jumps out that ff-find-other-file will create the expecting file name with
>> an extra
>> trailling backslash, which makes the the newly opened buffer as directory.
>> This happens after I updated all the 3rd party packages to the
>> latest version. Although I havn't found out which package caused this
>> issue, but the following patch will fix it, and I think it makes
>> more sense to use read-file-name than read-directory-name
>> 
>> --- emacs\share\emacs\24.5\lisp\find-file.el
>> +++ emacs\share\emacs\24.5\lisp\find-file.el
>> @@ -495,7 +495,7 @@
>> (setq name
>> (expand-file-name
>> - (read-directory-name
>> + (read-file-name
>> (format "Find or create %s in: " default-name)
>> default-directory default-name nil)))
>
>But that question is about the directory in which to create a file, so
>read-directory-name sounds about right to me.