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

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

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


From: Michael Albinus
Subject: bug#37883: 27.0.50; read-file-name: Scrambled INITIAL
Date: Wed, 23 Oct 2019 18:24:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Michael Heerdegen <michael_heerdegen@web.de> writes:

Hi Michael,

>> 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.

> What you cite also doesn't explain why this combination happens in the
> way it does.  The doubled ~/ seems not useful, and the /: is...some
> Tramp thing?

It isn't Tramp, rather the contrary. "/:" marks quoted file names,
i.e. file names which shouldn't be given to a file name handler.

> Michael.

Best regards, Michael.





reply via email to

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