emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9ca83cd: Revert "Use format-prompt in read-file-name calls that h


From: Lars Ingebrigtsen
Subject: master 9ca83cd: Revert "Use format-prompt in read-file-name calls that have a default"
Date: Sun, 13 Sep 2020 08:59:34 -0400 (EDT)

branch: master
commit 9ca83cdd79747fb09f714593243060b17b34e039
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Revert "Use format-prompt in read-file-name calls that have a default"
    
    This reverts commit de4f347901adffd07bc9bff028dc073fb3c6df33.
    
    read-file-name already displays a long path when given a default
    (like INITIAL in many other prompting functions), so using
    format-prompt here is superfluous.
---
 lisp/abbrev.el             |  4 ++--
 lisp/bookmark.el           |  6 +++---
 lisp/dired.el              |  5 ++---
 lisp/files.el              | 24 +++++++++++-------------
 lisp/gnus/gnus-bookmark.el |  3 ++-
 lisp/help-fns.el           | 10 ++++------
 lisp/mail/rmailmm.el       |  2 +-
 lisp/misearch.el           |  7 +++----
 lisp/progmodes/etags.el    |  4 ++--
 lisp/vc/diff-mode.el       |  7 +++----
 lisp/vc/ediff-ptch.el      | 12 ++++++++----
 lisp/vc/vc.el              | 18 +++++++++---------
 lisp/xwidget.el            | 17 ++++++++---------
 13 files changed, 58 insertions(+), 61 deletions(-)

diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 50d0011..be6f9ee 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -233,7 +233,7 @@ If VERBOSE is non-nil, display a message indicating where 
abbrevs
 have been saved."
   (interactive
    (list
-    (read-file-name (format-prompt "Write abbrev file" abbrev-file-name)
+    (read-file-name "Write abbrev file: "
                    (file-name-directory (expand-file-name abbrev-file-name))
                    abbrev-file-name)))
   (or (and file (> (length file) 0))
@@ -262,7 +262,7 @@ have been saved."
 (defun abbrev-edit-save-to-file (file)
   "Save all user-level abbrev definitions in current buffer to FILE."
   (interactive
-   (list (read-file-name (format-prompt "Save abbrevs to file" 
abbrev-file-name)
+   (list (read-file-name "Save abbrevs to file: "
                         (file-name-directory
                          (expand-file-name abbrev-file-name))
                         abbrev-file-name)))
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 206c872..dcb03ad 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1425,8 +1425,8 @@ for a file, defaulting to the file defined by variable
                              bookmark-default-file)))
             (if parg
                 ;; This should be part of the `interactive' spec.
-                (read-file-name (format-prompt "File to save bookmarks in"
-                                               default)
+                (read-file-name (format "File to save bookmarks in: (%s) "
+                                        default)
                                 (file-name-directory default) default)
               default))))
   (bookmark-write-file file)
@@ -1538,7 +1538,7 @@ unique numeric suffixes \"<2>\", \"<3>\", etc."
                   (or (car bookmark-bookmarks-timestamp)
                       (expand-file-name bookmark-default-file))))
         (prefix current-prefix-arg))
-     (list (read-file-name (format-prompt "Load bookmarks from" default)
+     (list (read-file-name (format "Load bookmarks from: (%s) " default)
                           (file-name-directory default) default 'confirm)
           prefix nil prefix)))
   (let* ((file (expand-file-name file))
diff --git a/lisp/dired.el b/lisp/dired.el
index 6e7b88f..15592ce 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -896,9 +896,8 @@ ERROR can be a string with the error message."
            (if (next-read-file-uses-dialog-p)
                (read-directory-name (format "Dired %s(directory): " str)
                                     nil default-directory nil)
-             (read-file-name (format-prompt "Dired %s(directory)"
-                                             default-directory str)
-                             nil default-directory)))))
+             (read-file-name (format "Dired %s(directory): " str)
+                             nil default-directory nil)))))
 
 ;; We want to switch to a more sophisticated version of
 ;; dired-read-dir-and-switches like the following, if there is a way
diff --git a/lisp/files.el b/lisp/files.el
index 71951dd..e6629d2 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4527,12 +4527,13 @@ Interactively, confirmation is required unless you 
supply a prefix argument."
 ;;  (interactive "FWrite file: ")
   (interactive
    (list (if buffer-file-name
-            (read-file-name "Write file: ")
-          (read-file-name
-            (format-prompt "Write file" (file-name-nondirectory (buffer-name)))
-            default-directory
-           (expand-file-name (file-name-nondirectory (buffer-name))
-                              default-directory)))
+            (read-file-name "Write file: "
+                            nil nil nil nil)
+          (read-file-name "Write file: " default-directory
+                          (expand-file-name
+                           (file-name-nondirectory (buffer-name))
+                           default-directory)
+                          nil nil))
         (not current-prefix-arg)))
   (or (null filename) (string-equal filename "")
       (progn
@@ -5270,13 +5271,10 @@ Before and after saving the buffer, this function runs
            (unless (run-hook-with-args-until-success 'write-contents-functions)
               ;; If buffer has no file name, ask user for one.
               (or buffer-file-name
-                  (let* ((default (expand-file-name (buffer-name)))
-                         (filename
-                          (expand-file-name
-                           (read-file-name
-                            (format-prompt "File to save in"
-                                           (file-name-nondirectory default))
-                            nil default))))
+                  (let ((filename
+                         (expand-file-name
+                          (read-file-name "File to save in: "
+                                          nil (expand-file-name 
(buffer-name))))))
                     (if (file-exists-p filename)
                         (if (file-directory-p filename)
                             ;; Signal an error if the user specified the name 
of an
diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el
index 7e96843..1b00bbb 100644
--- a/lisp/gnus/gnus-bookmark.el
+++ b/lisp/gnus/gnus-bookmark.el
@@ -315,7 +315,8 @@ affect point."
   "Load Gnus bookmarks from FILE (which must be in bookmark format)."
   (interactive
    (list (read-file-name
-          (format-prompt "Load Gnus bookmarks from" gnus-bookmark-default-file)
+          (format "Load Gnus bookmarks from: (%s) "
+                  gnus-bookmark-default-file)
           "~/" gnus-bookmark-default-file 'confirm)))
   (setq file (expand-file-name file))
   (if (file-readable-p file)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 0e20d0f..a9943cc 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1813,9 +1813,8 @@ one of them returns non-nil."
 ;;;###autoload
 (defun doc-file-to-man (file)
   "Produce an nroff buffer containing the doc-strings from the DOC file."
-  (interactive (list (read-file-name (format-prompt "Name of DOC file"
-                                                    internal-doc-file-name)
-                                     doc-directory internal-doc-file-name t)))
+  (interactive (list (read-file-name "Name of DOC file: " doc-directory
+                                     internal-doc-file-name t)))
   (or (file-readable-p file)
       (error "Cannot read file `%s'" file))
   (pop-to-buffer (generate-new-buffer "*man-doc*"))
@@ -1844,9 +1843,8 @@ one of them returns non-nil."
 ;;;###autoload
 (defun doc-file-to-info (file)
   "Produce a texinfo buffer with sorted doc-strings from the DOC file."
-  (interactive (list (read-file-name (format-prompt "Name of DOC file"
-                                                    internal-doc-file-name)
-                                     doc-directory internal-doc-file-name t)))
+  (interactive (list (read-file-name "Name of DOC file: " doc-directory
+                                     internal-doc-file-name t)))
   (or (file-readable-p file)
       (error "Cannot read file `%s'" file))
   (let ((i 0) type name doc alist)
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 0b9af82..29c6dcf 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -269,7 +269,7 @@ TRUNCATED is non-nil if the text of this entity was 
truncated."
        (unless (y-or-n-p "This entity is truncated; save anyway? ")
          (error "Aborted")))
     (setq filename (expand-file-name
-                   (read-file-name (format-prompt "Save as" filename)
+                   (read-file-name (format "Save as (default: %s): " filename)
                                    directory
                                    (expand-file-name filename directory))
                    directory))
diff --git a/lisp/misearch.el b/lisp/misearch.el
index 36a7afe..958c10a 100644
--- a/lisp/misearch.el
+++ b/lisp/misearch.el
@@ -316,10 +316,9 @@ Every next/previous file in the defined sequence is 
visited by
 (defun multi-isearch-read-files ()
   "Return a list of files specified interactively, one by one."
   ;; Most code from `multi-occur'.
-  (let* ((files (list (read-file-name
-                       (format-prompt "First file to search"
-                                      (file-name-nondirectory 
buffer-file-name))
-                      default-directory buffer-file-name)))
+  (let* ((files (list (read-file-name "First file to search: "
+                                     default-directory
+                                     buffer-file-name)))
         (file nil))
     (while (not (string-equal
                 (setq file (read-file-name
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 81cb2b7..2c5c365 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -292,7 +292,7 @@ file the tag was in."
            (or (locate-dominating-file default-directory "TAGS")
                default-directory)))
      (list (read-file-name
-            (format-prompt "Visit tags table" "TAGS")
+            "Visit tags table (default TAGS): "
             ;; default to TAGS from default-directory up to root.
             default-tag-dir
             (expand-file-name "TAGS" default-tag-dir)
@@ -625,7 +625,7 @@ Returns t if it visits a tags table, or nil if there are no 
more in the list."
                  (car list))
                ;; Finally, prompt the user for a file name.
                (expand-file-name
-                (read-file-name (format-prompt "Visit tags table" "TAGS")
+                (read-file-name "Visit tags table (default TAGS): "
                                 default-directory
                                 "TAGS"
                                 t))))))
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index f272db1..1a80d13 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -911,11 +911,10 @@ like \(diff-merge-strings \"b/foo\" \"b/bar\" 
\"/a/c/foo\")."
 If the OLD prefix arg is passed, tell the file NAME of the old file."
   (interactive
    (let* ((old current-prefix-arg)
-         (fs (diff-hunk-file-names current-prefix-arg))
-          (default (diff-find-file-name old 'noprompt)))
+         (fs (diff-hunk-file-names current-prefix-arg)))
      (unless fs (error "No file name to look for"))
-     (list old (read-file-name (format-prompt "File for %s" default (car fs))
-                              nil default t))))
+     (list old (read-file-name (format "File for %s: " (car fs))
+                              nil (diff-find-file-name old 'noprompt) t))))
   (let ((fs (diff-hunk-file-names old)))
     (unless fs (error "No file name to look for"))
     (push (cons fs name) diff-remembered-files-alist)))
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index 8b12209..f6af5a4 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -499,11 +499,15 @@ are two possible targets for this %spatch.  However, 
these files do not exist."
        patch-file-name)
     (setq patch-file-name
          (read-file-name
-          (format-prompt "Patch is in file"
-                         (and buffer-file-name
+          (format "Patch is in file%s: "
+                  (cond ((and buffer-file-name
                               (equal (expand-file-name dir)
-                                     (file-name-directory buffer-file-name))
-                              (file-name-nondirectory buffer-file-name)))
+                                     (file-name-directory buffer-file-name)))
+                         (concat
+                          " (default "
+                          (file-name-nondirectory buffer-file-name)
+                          ")"))
+                        (t "")))
           dir buffer-file-name 'must-match))
     (if (file-directory-p patch-file-name)
        (error "Patch file cannot be a directory: %s" patch-file-name)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 983fb59..4cbd265 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -953,9 +953,10 @@ use."
              ;; repository, make sure it's a parent of
              ;; file.
              (read-file-name
-              (format-prompt "create %s repository in" def-dir bk)
+              (format "create %s repository in: " bk)
               default-directory def-dir t nil
               (lambda (arg)
+                (message "arg %s" arg)
                 (and (file-directory-p arg)
                      (string-prefix-p (expand-file-name arg) def-dir)))))))
           (let ((default-directory repo-dir))
@@ -2899,10 +2900,10 @@ backend to NEW-BACKEND, and unregister FILE from the 
current backend.
   "Delete file and mark it as such in the version control system.
 If called interactively, read FILE, defaulting to the current
 buffer's file name if it's under version control."
-  (interactive (list (let ((default (when (vc-backend buffer-file-name)
-                                      buffer-file-name)))
-                       (read-file-name "VC delete file" default)
-                       nil default t)))
+  (interactive (list (read-file-name "VC delete file: " nil
+                                     (when (vc-backend buffer-file-name)
+                                       buffer-file-name)
+                                     t)))
   (setq file (expand-file-name file))
   (let ((buf (get-file-buffer file))
         (backend (vc-backend file)))
@@ -2943,10 +2944,9 @@ buffer's file name if it's under version control."
   "Rename file OLD to NEW in both work area and repository.
 If called interactively, read OLD and NEW, defaulting OLD to the
 current buffer's file name if it's under version control."
-  (interactive (list (let ((default (when (vc-backend buffer-file-name)
-                                      buffer-file-name)))
-                       (read-file-name (format-prompt "VC rename file" default)
-                                       nil default t))
+  (interactive (list (read-file-name "VC rename file: " nil
+                                     (when (vc-backend buffer-file-name)
+                                       buffer-file-name) t)
                      (read-file-name "Rename to: ")))
   ;; in CL I would have said (setq new (merge-pathnames new old))
   (let ((old-base (file-name-nondirectory old)))
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index d6ca300..0743208 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -326,15 +326,14 @@ If non-nil, plugins are enabled.  Otherwise, disabled."))
 FILE-NAME combined with `xwidget-webkit-download-dir' is the default file name
 of the prompt when reading.  When the file name the user specified is a
 directory, URL is saved at the specified directory as FILE-NAME."
-  (let* ((default (when file-name
-                    (expand-file-name
-                     file-name
-                     xwidget-webkit-download-dir)))
-         (save-name
-          (read-file-name
-           (format-prompt "Save URL `%s' of type `%s' in file/directory"
-                          default url mime-type)
-           xwidget-webkit-download-dir default)))
+  (let ((save-name (read-file-name
+                    (format "Save URL `%s' of type `%s' in file/directory: "
+                            url mime-type)
+                    xwidget-webkit-download-dir
+                    (when file-name
+                      (expand-file-name
+                       file-name
+                       xwidget-webkit-download-dir)))))
     (if (file-directory-p save-name)
         (setq save-name
               (expand-file-name (file-name-nondirectory file-name) save-name)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]