Subject: Re: bug#37883: 27.0.50; read-file-name: Scrambled INITIAL

From: Eli Zaretskii <[email-masked]>
Date: Fri, 25 Oct 2019 11:45:18 +0300

> From: Michael Albinus <[email-masked]>
> Date: Wed, 23 Oct 2019 18:24:55 +0200
> Cc: Andreas Schwab <[email-masked]>, [email-masked]
> 
> >> The docstring of `read-file-name' says
> >>
> >> If DEFAULT-FILENAME is omitted or nil, then if INITIAL is non-nil, the
> >> default is DIR combined with INITIAL
> >
> > But I'm talking about the initial minibuffer contents, not the default.
> > Is it due to historic reasons that the initial contents resemble this
> > default?
> 
> It is not said explicitly, but INITIAL is expected to be a trailing
> string of DEFAULT-FILENAME, where the cursor stays in the minibuffer.
> 
> And yes, in your case (with a nil DIR and a nil DEFAUL-FILENAME), DIR is
> set to "~/", and DEFAUL-FILENAME is set to "~/.bash_history". Finally,
> (minibuffer-maybe-quote-filename (concat dir initial)) is called.
> (concat dir initial) expands to "~/~/.bash_history", and
> (minibuffer-maybe-quote-filename ...) adds the leading "/:".
> 
> You better call (read-file-name-default "File: " "~/" nil nil ".bash_history" nil)
> 
> If read-file-name-default does not satisfy your needs, you might write
> your own read-file-name-function, and bind it to
> read-file-name-function.

Would someone like to suggest a documentation change to clarify these
issues?