diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2020-09-07 22:10:01 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-09-07 22:10:06 +0200 |
commit | de4f347901adffd07bc9bff028dc073fb3c6df33 (patch) | |
tree | a7b6653904dde6260d8708e94877a9a4e6e9b3c1 /lisp/vc | |
parent | 151486931c82f6af38a912631c9cd41b677aae47 (diff) | |
download | emacs-de4f347901adffd07bc9bff028dc073fb3c6df33.tar.gz |
Use format-prompt in read-file-name calls that have a default
* lisp/xwidget.el (xwidget-webkit-save-as-file):
* lisp/vc/vc.el (vc-backend-for-registration, vc-delete-file)
(vc-rename-file):
* lisp/vc/ediff-ptch.el (ediff-prompt-for-patch-file):
* lisp/vc/diff-mode.el (diff-tell-file-name):
* lisp/progmodes/etags.el (visit-tags-table)
(visit-tags-table-buffer):
* lisp/misearch.el (multi-isearch-read-files):
* lisp/mail/rmailmm.el (rmail-mime-save):
* lisp/help-fns.el (doc-file-to-man, doc-file-to-info):
* lisp/gnus/gnus-bookmark.el (gnus-bookmark-load):
* lisp/files.el (write-file, basic-save-buffer):
* lisp/dired.el (dired-read-dir-and-switches):
* lisp/bookmark.el (bookmark-save, bookmark-load):
* lisp/abbrev.el (write-abbrev-file, abbrev-edit-save-to-file):
Use format-prompt in read-file-name calls that have a default.
Diffstat (limited to 'lisp/vc')
-rw-r--r-- | lisp/vc/diff-mode.el | 7 | ||||
-rw-r--r-- | lisp/vc/ediff-ptch.el | 12 | ||||
-rw-r--r-- | lisp/vc/vc.el | 18 |
3 files changed, 17 insertions, 20 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 9c41d508b6b..a1fdd11ca04 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -911,10 +911,11 @@ 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))) + (fs (diff-hunk-file-names current-prefix-arg)) + (default (diff-find-file-name old 'noprompt))) (unless fs (error "No file name to look for")) - (list old (read-file-name (format "File for %s: " (car fs)) - nil (diff-find-file-name old 'noprompt) t)))) + (list old (read-file-name (format-prompt "File for %s" default (car fs)) + nil default 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 f6af5a45550..8b122093c15 100644 --- a/lisp/vc/ediff-ptch.el +++ b/lisp/vc/ediff-ptch.el @@ -499,15 +499,11 @@ are two possible targets for this %spatch. However, these files do not exist." patch-file-name) (setq patch-file-name (read-file-name - (format "Patch is in file%s: " - (cond ((and buffer-file-name + (format-prompt "Patch is in file" + (and buffer-file-name (equal (expand-file-name dir) - (file-name-directory buffer-file-name))) - (concat - " (default " - (file-name-nondirectory buffer-file-name) - ")")) - (t ""))) + (file-name-directory buffer-file-name)) + (file-name-nondirectory buffer-file-name))) 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 4cbd2658f80..983fb598f70 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -953,10 +953,9 @@ use." ;; repository, make sure it's a parent of ;; file. (read-file-name - (format "create %s repository in: " bk) + (format-prompt "create %s repository in" def-dir 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)) @@ -2900,10 +2899,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 (read-file-name "VC delete file: " nil - (when (vc-backend buffer-file-name) - buffer-file-name) - t))) + (interactive (list (let ((default (when (vc-backend buffer-file-name) + buffer-file-name))) + (read-file-name "VC delete file" default) + nil default t))) (setq file (expand-file-name file)) (let ((buf (get-file-buffer file)) (backend (vc-backend file))) @@ -2944,9 +2943,10 @@ 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 (read-file-name "VC rename file: " nil - (when (vc-backend buffer-file-name) - buffer-file-name) t) + (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)) (read-file-name "Rename to: "))) ;; in CL I would have said (setq new (merge-pathnames new old)) (let ((old-base (file-name-nondirectory old))) |