summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-07-20 13:48:10 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-07-20 13:48:10 +0200
commite02576c7eb75f35e5cc4fa5aa213f0838e2bd168 (patch)
tree7f3b7ab635646d378090bdec64e6a61f15572cfc /lisp
parent06ee8ac36c9590ed028a3633a21a655104f772c8 (diff)
downloademacs-e02576c7eb75f35e5cc4fa5aa213f0838e2bd168.tar.gz
emacs-e02576c7eb75f35e5cc4fa5aa213f0838e2bd168.tar.bz2
emacs-e02576c7eb75f35e5cc4fa5aa213f0838e2bd168.zip
Put command line file names and mouse dragging onto 'file-name-history'
* lisp/dnd.el (dnd-open-local-file): Add file to history. * lisp/files.el (file-name-history--add): New function (bug#12915). * lisp/startup.el (command-line-1): Add file to history.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dnd.el1
-rw-r--r--lisp/files.el4
-rw-r--r--lisp/startup.el1
3 files changed, 6 insertions, 0 deletions
diff --git a/lisp/dnd.el b/lisp/dnd.el
index 7319a27d190..e641b2843a9 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -180,6 +180,7 @@ An alternative for systems that do not support unc file names is
(if dnd-open-file-other-window
(find-file-other-window f)
(find-file f))
+ (file-name-history--add f)
'private)
(error "Can not read %s" uri))))
diff --git a/lisp/files.el b/lisp/files.el
index 59077cd266a..c265f33550f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1702,6 +1702,10 @@ rather than FUN itself, to `minibuffer-setup-hook'."
(list (read-file-name prompt nil default-directory mustmatch)
t))
+(defun file-name-history--add (file)
+ "Add FILE to `file-name-history'."
+ (add-to-history 'file-name-history (abbreviate-file-name file)))
+
(defun find-file (filename &optional wildcards)
"Edit file FILENAME.
Switch to a buffer visiting file FILENAME,
diff --git a/lisp/startup.el b/lisp/startup.el
index 456c01efd13..f337f7c6bcf 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2391,6 +2391,7 @@ nil default-directory" name)
(command-line-normalize-file-name name)
dir))
(buf (find-file-noselect file)))
+ (file-name-history--add 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