unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* calling desktop-read interactively
@ 2019-09-26  2:52 Juanma Barranquero
  2019-09-26  7:30 ` Eli Zaretskii
  2019-09-26 12:36 ` Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Juanma Barranquero @ 2019-09-26  2:52 UTC (permalink / raw)
  To: Emacs developers


[-- Attachment #1.1: Type: text/plain, Size: 138 bytes --]

I've implemented an old FIXME in desktop.el

;; FIXME Interactively, this should have the option to prompt for dirname.

Ok to push this?

[-- Attachment #1.2: Type: text/html, Size: 230 bytes --]

[-- Attachment #2: desktop.patch --]
[-- Type: application/octet-stream, Size: 1889 bytes --]

diff --git i/etc/NEWS w/etc/NEWS
index 9a0b6333e4..79e9655350 100644
--- i/etc/NEWS
+++ w/etc/NEWS
@@ -543,4 +543,9 @@ 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
diff --git i/lisp/desktop.el w/lisp/desktop.el
index 59610a128a..498f769bd3 100644
--- i/lisp/desktop.el
+++ w/lisp/desktop.el
@@ -1192,7 +1192,6 @@ 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
@@ -1200,7 +1199,9 @@ desktop-read
 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
@@ -1210,4 +1211,6 @@ desktop-read
              ;; 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))

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-09-27 12:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26  2:52 calling desktop-read interactively Juanma Barranquero
2019-09-26  7:30 ` Eli Zaretskii
2019-09-26 12:36 ` Stefan Monnier
2019-09-26 12:53   ` Juanma Barranquero
2019-09-26 15:32     ` Stefan Monnier
2019-09-26 16:06       ` Juanma Barranquero
2019-09-26 16:31         ` Eli Zaretskii
2019-09-26 16:52           ` Juanma Barranquero
2019-09-26 16:20       ` Drew Adams
2019-09-26 16:28       ` Eli Zaretskii
2019-09-26 19:42         ` Stefan Monnier
2019-09-27  4:59           ` Eli Zaretskii
2019-09-27 12:45             ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).