GNU bug report logs - #3909
23.1.50; Drag drop events in command history?

Previous Next

Package: emacs;

Reported by: Sridhar Boovaraghavan <sridhar_ml <at> yahoo.com>

Date: Thu, 23 Jul 2009 20:10:05 UTC

Severity: wishlist

Merged with 12915

Found in version 24.2.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3909 in the body.
You can then email your comments to 3909 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3909; Package emacs. (Thu, 23 Jul 2009 20:10:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sridhar Boovaraghavan <sridhar_ml <at> yahoo.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 23 Jul 2009 20:10:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Sridhar Boovaraghavan <sridhar_ml <at> yahoo.com>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.1.50; Drag drop events in command history?
Date: Thu, 23 Jul 2009 16:03:32 -0400
If in Windows, I drag a file from explorer and drop it into Emacs, it
opens fine. However, would it make sense for an event to be registered
in the command history (like open-file xxx) so that when I kill that
buffer and want to re-open it, I can just recall that command?

Regards,
Sridhar

In GNU Emacs 23.1.50.1 (i386-mingw-nt6.0.6002)
 of 2009-07-22 on BOB-MARLEY
Windowing system distributor `Microsoft Corp.', version 6.0.6002
configured using `configure --with-gcc (3.4) --cflags -Id:/Utilities/GnuWin32/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Message

Minor modes in effect:
  mml-mode: t
  gnus-message-citation-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
<help-echo> <help-echo> <drag-n-drop> <escape> x r 
e c o v e r <tab> t h i u <tab> <backspace> <tab> <return> 
y e s <return> C-k C-k C-k C-x s y C-x <escape> <escape> 
<escape> p <escape> p C-u <escape> x g n u s <return> 
n e w s . g m a n e . o r g <return> ; j g m a n e 
. e m a c s . d e v e l <return> u SPC 1 0 0 0 0 <backspace> 
<return> C-x 1 <next> <next> <next> <next> <prior> 
<prior> <prior> <down-mouse-1> <mouse-2> n SPC C-x 
1 n C-x 1 n SPC SPC C-x 1 <escape> > a D r a g - d 
r o p SPC i n SPC t h e SPC c o m m a n d SPC h i s 
t o r y ? <C-left> <C-left> <C-left> <C-left> e v e 
n t s SPC <down> <C-left> <C-left> <C-left> C-k s r 
i d h a r _ m l @ y a h o o . c o m <down> <down> <help-echo> 
C-x 5 2 <switch-frame> <escape> x r e p o r t <tab> 
<return>

Recent messages:
`A k' to list killed groups
Checking new news...done
Setting up drafts group
No more newsgroups
Retrieving newsgroup: gmane.emacs.devel...
Creating nntp marks directory c:/Users/Sridhar/AppData/Roaming/News/marks/news.gmane.org/gmane/emacs/devel/
Bootstrapping marks for gmane.emacs.devel...done
Fetching headers for gmane.emacs.devel...done
Generating summary...done
Mark set

Load-path shadows:
d:/site-lisp/u-vm-color hides d:/site-lisp/vm/lisp/u-vm-color
d:/site-lisp/bbdb/lisp/bbdb-autoloads hides d:/emacs/lisp/bbdb-autoloads
d:/site-lisp/feedmail hides d:/emacs/lisp/mail/feedmail

-- 
Sridhar Boovaraghavan



Severity set to `wishlist' from `normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sun, 26 Jul 2009 15:55:05 GMT) Full text and rfc822 format available.

Forcibly Merged 3909 12915. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 06 Feb 2013 23:21:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3909; Package emacs. (Sun, 18 Jul 2021 19:22:02 GMT) Full text and rfc822 format available.

Message #12 received at 3909 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 12915 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 3909 <at> debbugs.gnu.org
Subject: Re: bug#3909: 23.1.50; Drag drop events in command history?
Date: Sun, 18 Jul 2021 21:21:43 +0200
Dani Moncayo <dmoncayo <at> gmail.com> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3909; Package emacs. (Sun, 18 Jul 2021 21:09:02 GMT) Full text and rfc822 format available.

Message #15 received at 3909 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Dani Moncayo <dmoncayo <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, "12915 <at> debbugs.gnu.org" <12915 <at> debbugs.gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>,
 "3909 <at> debbugs.gnu.org" <3909 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#12915: bug#3909: 23.1.50; Drag drop events in
 command history?
Date: Sun, 18 Jul 2021 21:08:40 +0000
> 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?

In the #12915 thread both Juri and I argued for having
(multiple) means of _user_ control.  And several such means
were suggested.

I said, for example:

  Give users the _possibility_ of including, as part of
  `file-name-history', file names not actually typed in the
  minibuffer.  But give them also the ability to _choose_
  which such names get added, as defined by how the files
  were chosen for access.

Juri said, specifically to argue against your #1::

  Since this is a matter of personal preference, I think
  not Lisp callers but Emacs users should be able to specify
  what to add to the history.

There are lots of good suggestions in the thread - many
specific and some based on actual implementation and use.
Asking "Anybody got an opinion?" is an invitation to
ignore lots of opinions already carefully expressed. 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3909; Package emacs. (Sun, 18 Jul 2021 22:40:02 GMT) Full text and rfc822 format available.

Message #18 received at 3909 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 12915 <at> debbugs.gnu.org, 3909 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12915: bug#3909: 23.1.50; Drag drop events in command history?
Date: Mon, 19 Jul 2021 01:32:05 +0300
> 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.

I don't think anyone would object to such patch:

diff --git a/lisp/startup.el b/lisp/startup.el
index 456c01efd1..46252e7b93 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2391,6 +2391,7 @@ command-line-1
 				  (command-line-normalize-file-name name)
 				  dir))
 			   (buf (find-file-noselect file)))
+		      (add-to-history 'file-name-history (abbreviate-file-name file))
 		      (setq displayable-buffers (cons buf displayable-buffers))
                       ;; Set the file buffer to the current buffer so
                       ;; that it will be used with "--eval" and

And the same for drag and drop.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3909; Package emacs. (Sun, 18 Jul 2021 22:51:01 GMT) Full text and rfc822 format available.

Message #21 received at 3909 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Glenn Morris <rgm <at> gnu.org>, 12915 <at> debbugs.gnu.org, 3909 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12915: bug#3909: 23.1.50; Drag drop events in command history?
Date: Mon, 19 Jul 2021 00:50:42 +0200
Juri Linkov <juri <at> linkov.net> writes:

>> 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.
>
> I don't think anyone would object to such patch:

[...]

> @@ -2391,6 +2391,7 @@ command-line-1
>  				  (command-line-normalize-file-name name)
>  				  dir))
>  			   (buf (find-file-noselect file)))
> +		      (add-to-history 'file-name-history (abbreviate-file-name file))

I thought it might be nice to have these "extra" additions to
`file-name-history' in one central place (in case we decide to make it
optional).

But I guess we could just have a function like
`add-to-file-name-history' if we wanted to future-proof that?

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3909; Package emacs. (Mon, 19 Jul 2021 15:44:02 GMT) Full text and rfc822 format available.

Message #24 received at 3909 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 12915 <at> debbugs.gnu.org, 3909 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12915: bug#3909: 23.1.50; Drag drop events in command history?
Date: Mon, 19 Jul 2021 18:24:08 +0300
>>> 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.
>>
>> @@ -2391,6 +2391,7 @@ command-line-1
>>  				  (command-line-normalize-file-name name)
>>  				  dir))
>>  			   (buf (find-file-noselect file)))
>> +		      (add-to-history 'file-name-history (abbreviate-file-name file))
>
> I thought it might be nice to have these "extra" additions to
> `file-name-history' in one central place (in case we decide to make it
> optional).

`find-file' can't be such central place, because there are many other
file-reading commands like find-file-other-window, find-file-other-frame, …

Long ago I tried:

  (defun add-file-name-to-history ()
    "Add the name of the file just opened to the history."
    (when (and buffer-file-name (not buffer-read-only))
      (add-to-history 'file-name-history buffer-file-name)))
  (add-hook 'find-file-hook 'add-file-name-to-history)
  (add-hook 'first-change-hook 'add-file-name-to-history)

But it clutters up the history.  Maybe a new defcustom e.g.
`add-file-name-commands' could help with such options
as a list of command names to selectively add their args to the history,
or a regexp of command names.

> But I guess we could just have a function like
> `add-to-file-name-history' if we wanted to future-proof that?

This is not specific to the file history, the same requests were about
e.g. describe-function, describe-variable, …  So also tried:

  (define-advice describe-function (:before (function))
    "Add function name to the history."
    (when (and function (symbolp function))
      (add-to-history 'minibuffer-history (symbol-name function))))

  (define-advice describe-variable (:before (variable &optional _buffer _frame))
    "Add variable name to the history."
    (when (and variable (symbolp variable))
      (add-to-history 'minibuffer-history (symbol-name variable))))

  (define-advice describe-symbol (:before (symbol &optional _buffer _frame))
    "Add symbol name to the history."
    (when (and symbol (symbolp symbol))
      (add-to-history 'minibuffer-history (symbol-name symbol))))

But still too much clutter.  Maybe a more general defcustom is needed
that will accept a list of 3 parameters: command name, its argument number,
and a history variable, e.g. '((find-file-other-window 1 file-name-history) …)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3909; Package emacs. (Mon, 19 Jul 2021 15:52:02 GMT) Full text and rfc822 format available.

Message #27 received at 3909 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Glenn Morris <rgm <at> gnu.org>, 12915 <at> debbugs.gnu.org, 3909 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12915: bug#3909: 23.1.50; Drag drop events in command history?
Date: Mon, 19 Jul 2021 17:51:23 +0200
Juri Linkov <juri <at> linkov.net> writes:

>> But I guess we could just have a function like
>> `add-to-file-name-history' if we wanted to future-proof that?
>
> This is not specific to the file history, the same requests were about
> e.g. describe-function, describe-variable, …  So also tried:

I think you're over-thinking this.  :-)  There's a lot of controversial
things we could be doing in the history area, but we're not doing it,
because:

> But still too much clutter.

Adding drag'n'drop file names and command name file names isn't
controversial, and can be done easily, so we should just do that.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3909; Package emacs. (Mon, 19 Jul 2021 22:03:02 GMT) Full text and rfc822 format available.

Message #30 received at 3909 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 12915 <at> debbugs.gnu.org, 3909 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12915: bug#3909: 23.1.50; Drag drop events in command history?
Date: Tue, 20 Jul 2021 00:57:24 +0300
> Juri Linkov <juri <at> linkov.net> writes:
>
>>> But I guess we could just have a function like
>>> `add-to-file-name-history' if we wanted to future-proof that?
>>
>> This is not specific to the file history, the same requests were about
>> e.g. describe-function, describe-variable, …  So also tried:
>
> I think you're over-thinking this.  :-)

I completely agree.

> There's a lot of controversial things we could be doing in the history
> area, but we're not doing it, because:
>
>> But still too much clutter.
>
> Adding drag'n'drop file names and command name file names isn't
> controversial, and can be done easily, so we should just do that.

Then it should be enough just to add after the find-file call:

  (add-to-history 'file-name-history (abbreviate-file-name file))

in command-line-1 and drag-n-drop functions.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3909; Package emacs. (Tue, 20 Jul 2021 11:50:02 GMT) Full text and rfc822 format available.

Message #33 received at 3909 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Glenn Morris <rgm <at> gnu.org>, 3909 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, Dani Moncayo <dmoncayo <at> gmail.com>,
 12915 <at> debbugs.gnu.org
Subject: Re: bug#12915: bug#3909: 23.1.50; Drag drop events in command history?
Date: Tue, 20 Jul 2021 13:48:54 +0200
Juri Linkov <juri <at> linkov.net> writes:

> Then it should be enough just to add after the find-file call:
>
>   (add-to-history 'file-name-history (abbreviate-file-name file))
>
> in command-line-1 and drag-n-drop functions.

I've now done so, but via a trivial helper function, and I'm closing
this bug report.

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




bug marked as fixed in version 28.1, send any further explanations to 12915 <at> debbugs.gnu.org and Dani Moncayo <dmoncayo <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 20 Jul 2021 11:50:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 18 Aug 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.