Subject: bug#3909: 23.1.50; Drag drop events in command history?

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 18 Jul 2021 21:21:43 +0200

Dani Moncayo <[email-masked]> writes:

>>> Please, when a file is visited via drag-and-drop, add that file to the
>>> history of visited files (so that I can revisit it with `C-x C-f M-p',
>>> for example).  I don't see the point of not doing that.
>>
>> On a related note, I've always found it irritating that the same is true
>> of files specified on the command line:
>>
>> emacs -Q README &
>> C-x C-k README RET
>> C-x C-f M-p
>>   -> "Beginning of history; no preceding item"
>
> Indeed.  The history of visited files should contain every visited
> file, regardless of the way it was visited (command line argument,
> drag-n-drop, menu item, C-x C-f...)

The discussion here veered off into generalities, and nothing was done.

The two practical suggestions were:

1) To add an optional parameter to `find-file' to make it push the
filename onto `file-name-history'.  Then we could adjust callers
according to taste: I think drag and drop and command line arguments
should land on the history.

2) To add a `display-buffer-hook' to do the same if the file actually
ends up being displayed, so this pushing would happen deep in
`find-file-noselect'.

I think 1) is attractive in that it's very straightforward and simple to
understand.  2) is attractive in that we don't put file names into the
history unless we actually read the file, and we don't have to adjust
function parameters for the other `find-file-*' commands, too.

I think I prefer 1), because it's easier to reason about.

Anybody got an opinion?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no