unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: calling desktop-read interactively
Date: Thu, 26 Sep 2019 04:52:46 +0200	[thread overview]
Message-ID: <CAAeL0SSjKOhtis7xpWWp_mOCxgPCCD96=TyA+jG98gc0JtFfrw@mail.gmail.com> (raw)


[-- 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))

             reply	other threads:[~2019-09-26  2:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26  2:52 Juanma Barranquero [this message]
2019-09-26  7:30 ` calling desktop-read interactively 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAeL0SSjKOhtis7xpWWp_mOCxgPCCD96=TyA+jG98gc0JtFfrw@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).