1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

* lisp/desktop.el (desktop-read): With argument, ask the user for DIRNAME.

* etc/NEWS: Document it.
This commit is contained in:
Juanma Barranquero 2019-09-26 12:15:36 +02:00
parent 1667bc2fa7
commit 13a15a3a5a
2 changed files with 12 additions and 4 deletions

View File

@ -542,6 +542,11 @@ network connection information (in addition to the host name).
** The 'cl' package is now officially deprecated in favor of 'cl-lib'.
---
** desktop
*** When called interactively with a prefix arg 'C-u', 'desktop-read'
now prompts the user for the directory containing the desktop file.
+++
** winner
*** A new variable, 'winner-boring-buffers-regexp', has been added.

View File

@ -1191,17 +1191,18 @@ being set (usually, by reading it from the desktop)."
(defvar desktop-buffer-ok-count)
(defvar desktop-buffer-fail-count)
;; FIXME Interactively, this should have the option to prompt for dirname.
;;;###autoload
(defun desktop-read (&optional dirname)
(defun desktop-read (&optional dirname ask)
"Read and process the desktop file in directory DIRNAME.
Look for a desktop file in DIRNAME, or if DIRNAME is omitted, look in
directories listed in `desktop-path'. If a desktop file is found, it
is processed and `desktop-after-read-hook' is run. If no desktop file
is found, clear the desktop and run `desktop-no-desktop-file-hook'.
Interactively, with prefix arg \\[universal-argument], ask for DIRNAME.
This function is a no-op when Emacs is running in batch mode.
It returns t if a desktop file was loaded, nil otherwise."
(interactive)
It returns t if a desktop file was loaded, nil otherwise.
\n(fn DIRNAME)"
(interactive "i\nP")
(unless noninteractive
(setq desktop-dirname
(file-name-as-directory
@ -1209,6 +1210,8 @@ It returns t if a desktop file was loaded, nil otherwise."
(or
;; If DIRNAME is specified, use it.
(and (< 0 (length dirname)) dirname)
;; Else, with a prefix arg, ask for a directory name.
(and ask (read-directory-name "Directory for desktop file: " nil nil t))
;; Otherwise search desktop file in desktop-path.
(let ((dirs desktop-path))
(while (and dirs