summaryrefslogtreecommitdiff
path: root/lisp/desktop.el
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2019-09-26 12:15:36 +0200
committerJuanma Barranquero <lekktu@gmail.com>2019-09-26 12:17:20 +0200
commit13a15a3a5a123e0e3377f41974ce12af69c8d5e0 (patch)
tree97cfd36a886ec1920e1ecab106692d25e3adde98 /lisp/desktop.el
parent1667bc2fa7ab0dde34313bd149cf886b37707d56 (diff)
downloademacs-13a15a3a5a123e0e3377f41974ce12af69c8d5e0.tar.gz
emacs-13a15a3a5a123e0e3377f41974ce12af69c8d5e0.tar.bz2
emacs-13a15a3a5a123e0e3377f41974ce12af69c8d5e0.zip
* lisp/desktop.el (desktop-read): With argument, ask the user for DIRNAME.
* etc/NEWS: Document it.
Diffstat (limited to 'lisp/desktop.el')
-rw-r--r--lisp/desktop.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 59610a128a3..498f769bd32 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -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