diff options
| author | Lars Ingebrigtsen | 2021-07-20 13:48:10 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-07-20 13:48:10 +0200 |
| commit | e02576c7eb75f35e5cc4fa5aa213f0838e2bd168 (patch) | |
| tree | 7f3b7ab635646d378090bdec64e6a61f15572cfc | |
| parent | 06ee8ac36c9590ed028a3633a21a655104f772c8 (diff) | |
| download | emacs-e02576c7eb75f35e5cc4fa5aa213f0838e2bd168.tar.gz 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.
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | lisp/dnd.el | 1 | ||||
| -rw-r--r-- | lisp/files.el | 4 | ||||
| -rw-r--r-- | lisp/startup.el | 1 |
4 files changed, 14 insertions, 0 deletions
| @@ -92,6 +92,10 @@ proper pty support that Emacs needs. | |||
| 92 | * Startup Changes in Emacs 28.1 | 92 | * Startup Changes in Emacs 28.1 |
| 93 | 93 | ||
| 94 | --- | 94 | --- |
| 95 | ** File names given on the command line will now be pushed onto | ||
| 96 | 'file-name-history'. | ||
| 97 | |||
| 98 | --- | ||
| 95 | ** In GTK builds, Emacs now supports startup notification. | 99 | ** In GTK builds, Emacs now supports startup notification. |
| 96 | This means that Emacs won't steal keyboard focus upon startup | 100 | This means that Emacs won't steal keyboard focus upon startup |
| 97 | (when started via the Desktop) if the user is typing into another | 101 | (when started via the Desktop) if the user is typing into another |
| @@ -335,6 +339,10 @@ by dragging the tab lines of their topmost windows with the mouse. | |||
| 335 | 339 | ||
| 336 | * Editing Changes in Emacs 28.1 | 340 | * Editing Changes in Emacs 28.1 |
| 337 | 341 | ||
| 342 | --- | ||
| 343 | ** Dragging a file to Emacs will now also push the name of the file | ||
| 344 | onto 'file-name-history'. | ||
| 345 | |||
| 338 | +++ | 346 | +++ |
| 339 | ** A prefix arg now causes 'delete-other-frames' to only iconify frames. | 347 | ** A prefix arg now causes 'delete-other-frames' to only iconify frames. |
| 340 | 348 | ||
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 | |||
| 180 | (if dnd-open-file-other-window | 180 | (if dnd-open-file-other-window |
| 181 | (find-file-other-window f) | 181 | (find-file-other-window f) |
| 182 | (find-file f)) | 182 | (find-file f)) |
| 183 | (file-name-history--add f) | ||
| 183 | 'private) | 184 | 'private) |
| 184 | (error "Can not read %s" uri)))) | 185 | (error "Can not read %s" uri)))) |
| 185 | 186 | ||
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'." | |||
| 1702 | (list (read-file-name prompt nil default-directory mustmatch) | 1702 | (list (read-file-name prompt nil default-directory mustmatch) |
| 1703 | t)) | 1703 | t)) |
| 1704 | 1704 | ||
| 1705 | (defun file-name-history--add (file) | ||
| 1706 | "Add FILE to `file-name-history'." | ||
| 1707 | (add-to-history 'file-name-history (abbreviate-file-name file))) | ||
| 1708 | |||
| 1705 | (defun find-file (filename &optional wildcards) | 1709 | (defun find-file (filename &optional wildcards) |
| 1706 | "Edit file FILENAME. | 1710 | "Edit file FILENAME. |
| 1707 | Switch to a buffer visiting file FILENAME, | 1711 | 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) | |||
| 2391 | (command-line-normalize-file-name name) | 2391 | (command-line-normalize-file-name name) |
| 2392 | dir)) | 2392 | dir)) |
| 2393 | (buf (find-file-noselect file))) | 2393 | (buf (find-file-noselect file))) |
| 2394 | (file-name-history--add file) | ||
| 2394 | (setq displayable-buffers (cons buf displayable-buffers)) | 2395 | (setq displayable-buffers (cons buf displayable-buffers)) |
| 2395 | ;; Set the file buffer to the current buffer so | 2396 | ;; Set the file buffer to the current buffer so |
| 2396 | ;; that it will be used with "--eval" and | 2397 | ;; that it will be used with "--eval" and |