]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert "Use format-prompt in read-file-name calls that have a default"
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 13 Sep 2020 12:58:24 +0000 (14:58 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 13 Sep 2020 12:58:24 +0000 (14:58 +0200)
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.

13 files changed:
lisp/abbrev.el
lisp/bookmark.el
lisp/dired.el
lisp/files.el
lisp/gnus/gnus-bookmark.el
lisp/help-fns.el
lisp/mail/rmailmm.el
lisp/misearch.el
lisp/progmodes/etags.el
lisp/vc/diff-mode.el
lisp/vc/ediff-ptch.el
lisp/vc/vc.el
lisp/xwidget.el

index 50d0011e8122428a2c0f00ecb6f628042399e023..be6f9ee34377c08d93749f98d7c68511f1ddc7eb 100644 (file)
@@ -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)))
index 206c87223c25e97e36770549c2e236256b81e44d..dcb03adadd8d0859091940f797b4c04a156f5685 100644 (file)
@@ -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))
index 6e7b88f0199a692317fd874adba1851497980133..15592ceb080b14cde39ad2d8404f5f8166e528bd 100644 (file)
@@ -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
index 71951dd349e51f9565313c6ad42ca5a041389348..e6629d2a21ad544f9bff0134b104628d96dfff66 100644 (file)
@@ -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
index 7e9684394ac9366c26456c81c1e726a639ff5f22..1b00bbbc69c0f25ec9442dd17561304421ad310b 100644 (file)
@@ -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)
index 0e20d0f35382c4c116386be276d2d0e70a7b9c20..a9943ccd7f40a3162d4f5b97558b41447e1e3142 100644 (file)
@@ -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)
index 0b9af8292b3c8536c41e78d446ffdbe27cbb2564..29c6dcf40e86bf64e9f9ce624e9ec653592d1222 100644 (file)
@@ -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))
index 36a7afe518c2c76405b7773ba537bd33029fa7b9..958c10a1bf651ce89b7539383509f856d0822e5e 100644 (file)
@@ -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
index 81cb2b7cd77d43957b11c278368a43157f546190..2c5c36504a9333b21ed5e5dfef4d221964ee6ce3 100644 (file)
@@ -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))))))
index f272db1f7d100060d9eeb45105f5022fc10a9e5e..1a80d13abde404167a139f949ad71be8a115fb7d 100644 (file)
@@ -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)))
index 8b122093c15b8807bbece80e97323c692187a8b6..f6af5a45550634c1a3d45951775b74ed5347ad9a 100644 (file)
@@ -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)
index 983fb598f700def177b66859ca4a4e9d521990ec..4cbd2658f801db9f4e152740037f57ff7436f89f 100644 (file)
@@ -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)))
index d6ca300f3aad24c91871c9cfd5e7bb7cd241851a..074320855c5f726998aede12a633381142612141 100644 (file)
@@ -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)))