mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-09 15:50:21 +00:00
Use format-prompt for many more prompts
* lisp/bookmark.el (bookmark-completing-read): * lisp/calc/calc-prog.el (calc-user-define-formula): * lisp/calc/calc-store.el (calc-permanent-variable): * lisp/calc/calc-units.el (calc-convert-units) (calc-convert-exact-units, calc-convert-temperature): * lisp/cedet/semantic/complete.el (semantic-complete-read-tag-engine): * lisp/cus-edit.el (customize-read-group): * lisp/dired-aux.el (dired-do-chxxx): * lisp/dired-x.el (dired-mark-unmarked-files): * lisp/emacs-lisp/debug.el (cancel-debug-on-entry) (cancel-debug-on-variable-change): * lisp/emacs-lisp/edebug.el (edebug-cancel-on-entry) (edebug-remove-instrumentation): * lisp/epa.el (epa-read-file-name, epa-export-keys): * lisp/faces.el (read-face-name): * lisp/format.el (format-decode-buffer, format-decode-region): * lisp/gnus/gnus-art.el (gnus-read-save-file-name): * lisp/gnus/gnus-util.el (gnus-completing-read): * lisp/gnus/message.el (message-check-news-header-syntax): * lisp/info.el (Info-follow-reference): * lisp/international/mule-diag.el (describe-font) (describe-fontset): * lisp/international/quail.el (quail-show-keyboard-layout): * lisp/language/cyril-util.el (standard-display-cyrillic-translit): * lisp/mail/rmailkwd.el (rmail-read-label): * lisp/mail/rmailmm.el (rmail-mime-save): * lisp/mail/rmailout.el (rmail-output-read-file-name): * lisp/man.el (Man-goto-section, Man-follow-manual-reference): * lisp/menu-bar.el (emacs-index--prompt): * lisp/net/ange-ftp.el (ange-ftp-get-passwd): * lisp/proced.el (proced-send-signal): * lisp/progmodes/cpp.el (cpp-choose-face): * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): * lisp/progmodes/etags.el (visit-tags-table) (visit-tags-table-buffer): * lisp/progmodes/grep.el (grep-read-files): * lisp/progmodes/hideif.el (hide-ifdef-define): * lisp/progmodes/pascal.el (pascal-goto-defun): * lisp/progmodes/prolog.el (prolog-read-predicate): * lisp/progmodes/sql.el (sql-get-login-ext): * lisp/ses.el (ses-define-local-printer): * lisp/textmodes/artist.el (artist-figlet-choose-font): * lisp/textmodes/tex-mode.el (tex-compile): * lisp/vc/diff.el (diff): * lisp/vc/ediff-ptch.el (ediff-prompt-for-patch-file): * lisp/vc/ediff-util.el (ediff-read-file-name): * lisp/vc/pcvs.el (cvs-mode-mark-on-state): * lisp/vc/vc.el (vc-diff-build-argument-list-internal) (vc-revision-other-window, vc-retrieve-tag): * lisp/wid-edit.el: Prefer format-prompt unconditionally. * lisp/org/org-capture.el (org-capture-fill-template): * lisp/org/org-refile.el (org-refile-get-location): * lisp/progmodes/python.el (python-eldoc-at-point): * lisp/progmodes/verilog-mode.el (verilog-surelint-off) (verilog-goto-defun): * lisp/progmodes/xref.el (xref--read-identifier): Prefer format-prompt when it is fboundp.
This commit is contained in:
parent
19444fb093
commit
6640942221
@ -498,11 +498,8 @@ If DEFAULT is nil then return empty string for empty input."
|
||||
'string-lessp)
|
||||
(bookmark-all-names)))
|
||||
(let* ((completion-ignore-case bookmark-completion-ignore-case)
|
||||
(default (unless (equal "" default) default))
|
||||
(prompt (concat prompt (if default
|
||||
(format " (%s): " default)
|
||||
": "))))
|
||||
(completing-read prompt
|
||||
(default (unless (equal "" default) default)))
|
||||
(completing-read (format-prompt prompt default)
|
||||
(lambda (string pred action)
|
||||
(if (eq action 'metadata)
|
||||
'(metadata (category . bookmark))
|
||||
|
@ -205,9 +205,8 @@
|
||||
(progn
|
||||
(setq cmd-base-default (concat "User-" keyname))
|
||||
(setq cmd (completing-read
|
||||
(concat "Define M-x command name (default calc-"
|
||||
cmd-base-default
|
||||
"): ")
|
||||
(format-prompt "Define M-x command name"
|
||||
(concat "calc-" cmd-base-default))
|
||||
obarray 'commandp nil
|
||||
(if (and odef (symbolp (cdr odef)))
|
||||
(symbol-name (cdr odef))
|
||||
@ -241,8 +240,8 @@
|
||||
(setq func
|
||||
(concat "calcFunc-"
|
||||
(completing-read
|
||||
(concat "Define algebraic function name (default "
|
||||
cmd-base-default "): ")
|
||||
(format-prompt "Define algebraic function name"
|
||||
cmd-base-default)
|
||||
(mapcar (lambda (x) (substring x 9))
|
||||
(all-completions "calcFunc-"
|
||||
obarray))
|
||||
|
@ -586,7 +586,7 @@
|
||||
(defun calc-permanent-variable (&optional var)
|
||||
(interactive)
|
||||
(calc-wrapper
|
||||
(or var (setq var (calc-read-var-name "Save variable (default all): ")))
|
||||
(or var (setq var (calc-read-var-name (format-prompt "Save variable" "all"))))
|
||||
(let (calc-pv-pos)
|
||||
(and var (or (and (boundp var) (symbol-value var))
|
||||
(error "No such variable")))
|
||||
|
@ -486,18 +486,13 @@ If COMP or STD is non-nil, put that in the units table instead."
|
||||
(setq defunits (math-get-default-units expr))
|
||||
(unless new-units
|
||||
(setq new-units
|
||||
(read-string (concat
|
||||
(read-string (format-prompt
|
||||
(if (and uoldname (not nouold))
|
||||
(concat "Old units: "
|
||||
uoldname
|
||||
", new units")
|
||||
"New units")
|
||||
(if defunits
|
||||
(concat
|
||||
" (default "
|
||||
defunits
|
||||
"): ")
|
||||
": "))))
|
||||
defunits)))
|
||||
(if (and
|
||||
(string= new-units "")
|
||||
defunits)
|
||||
@ -533,14 +528,7 @@ If COMP or STD is non-nil, put that in the units table instead."
|
||||
(let* ((old-units (math-extract-units expr))
|
||||
(defunits (math-get-default-units expr))
|
||||
units
|
||||
(new-units
|
||||
(read-string (concat "New units"
|
||||
(if defunits
|
||||
(concat
|
||||
" (default "
|
||||
defunits
|
||||
"): ")
|
||||
": ")))))
|
||||
(new-units (read-string (format-prompt "New units" defunits))))
|
||||
(if (and
|
||||
(string= new-units "")
|
||||
defunits)
|
||||
@ -596,19 +584,14 @@ If COMP or STD is non-nil, put that in the units table instead."
|
||||
(setq expr (math-mul expr uold)))
|
||||
(setq defunits (math-get-default-units expr))
|
||||
(setq unew (or new-units
|
||||
(completing-read
|
||||
(concat
|
||||
(if uoldname
|
||||
(concat "Old temperature units: "
|
||||
uoldname
|
||||
", new units")
|
||||
"New temperature units")
|
||||
(if defunits
|
||||
(concat " (default "
|
||||
defunits
|
||||
"): ")
|
||||
": "))
|
||||
tempunits)))
|
||||
(completing-read (format-prompt
|
||||
(if uoldname
|
||||
(concat "Old temperature units: "
|
||||
uoldname
|
||||
", new units")
|
||||
"New temperature units")
|
||||
defunits)
|
||||
tempunits)))
|
||||
(setq unew (math-read-expr (if (string= unew "") defunits unew)))
|
||||
(when (eq (car-safe unew) 'error)
|
||||
(error "Bad format in units expression: %s" (nth 2 unew)))
|
||||
|
@ -224,11 +224,10 @@ HISTORY is a symbol representing a variable to story the history in."
|
||||
|
||||
;; @todo - move from () to into the editable area
|
||||
(if (string-match ":" prompt)
|
||||
(setq prompt (concat
|
||||
(substring prompt 0 (match-beginning 0))
|
||||
" (default " default-as-string ")"
|
||||
(substring prompt (match-beginning 0))))
|
||||
(setq prompt (concat prompt " (" default-as-string "): "))))
|
||||
(setq prompt (format-prompt
|
||||
(substring prompt 0 (match-beginning 0))
|
||||
default-as-string))
|
||||
(setq prompt (format-prompt prompt default-as-string))))
|
||||
;;
|
||||
;; Perform the Completion
|
||||
;;
|
||||
|
@ -1133,7 +1133,7 @@ for the MODE to customize."
|
||||
|
||||
(defun customize-read-group ()
|
||||
(let ((completion-ignore-case t))
|
||||
(completing-read "Customize group (default emacs): "
|
||||
(completing-read (format-prompt "Customize group" "emacs")
|
||||
obarray
|
||||
(lambda (symbol)
|
||||
(or (and (get symbol 'custom-loads)
|
||||
|
@ -444,10 +444,10 @@ List has a form of (file-name full-file-name (attribute-list))."
|
||||
((eq op-symbol 'chgrp)
|
||||
(file-attribute-group-id
|
||||
(file-attributes default-file 'string))))))
|
||||
(prompt (concat "Change " attribute-name " of %s to"
|
||||
(if (eq op-symbol 'touch)
|
||||
" (default now): "
|
||||
": ")))
|
||||
(prompt (format-prompt "Change %s of %%s to"
|
||||
(when (eq op-symbol 'touch)
|
||||
"now")
|
||||
attribute-name))
|
||||
(new-attribute (dired-mark-read-string prompt nil op-symbol
|
||||
arg files default
|
||||
(cond ((eq op-symbol 'chown)
|
||||
|
@ -554,7 +554,7 @@ If the region is active in Transient Mark mode, operate only on
|
||||
files in the active region if `dired-mark-region' is non-nil."
|
||||
(interactive
|
||||
(list (read-regexp
|
||||
"Mark unmarked files matching regexp (default all): "
|
||||
(format-prompt "Mark unmarked files matching regexp" "all")
|
||||
nil 'dired-regexp-history)
|
||||
nil current-prefix-arg nil))
|
||||
(let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
|
||||
|
@ -701,7 +701,8 @@ To specify a nil argument interactively, exit with an empty minibuffer."
|
||||
(interactive
|
||||
(list (let ((name
|
||||
(completing-read
|
||||
"Cancel debug on entry to function (default all functions): "
|
||||
(format-prompt "Cancel debug on entry to function"
|
||||
"all functions")
|
||||
(mapcar #'symbol-name (debug--function-list)) nil t)))
|
||||
(when name
|
||||
(unless (string= name "")
|
||||
@ -804,7 +805,8 @@ To specify a nil argument interactively, exit with an empty minibuffer."
|
||||
(interactive
|
||||
(list (let ((name
|
||||
(completing-read
|
||||
"Cancel debug on set for variable (default all variables): "
|
||||
(format-prompt "Cancel debug on set for variable"
|
||||
"all variables")
|
||||
(mapcar #'symbol-name (debug--variable-list)) nil t)))
|
||||
(when name
|
||||
(unless (string= name "")
|
||||
|
@ -3519,7 +3519,8 @@ The removes the effect of `edebug-on-entry'. If FUNCTION is
|
||||
nil, remove `edebug-on-entry' on all functions."
|
||||
(interactive
|
||||
(list (let ((name (completing-read
|
||||
"Cancel edebug on entry to (default all functions): "
|
||||
(format-prompt "Cancel edebug on entry to"
|
||||
"all functions")
|
||||
(let ((functions (edebug--edebug-on-entry-functions)))
|
||||
(unless functions
|
||||
(user-error "No functions have `edebug-on-entry'"))
|
||||
@ -4548,7 +4549,8 @@ instrumentation for, defaulting to all functions."
|
||||
(user-error "Found no functions to remove instrumentation from"))
|
||||
(let ((name
|
||||
(completing-read
|
||||
"Remove instrumentation from (default all functions): "
|
||||
(format-prompt "Remove instrumentation from"
|
||||
"all functions")
|
||||
functions)))
|
||||
(if (and name
|
||||
(not (equal name "")))
|
||||
|
@ -648,7 +648,7 @@ If SECRET is non-nil, list secret keys instead of public keys."
|
||||
(setq input (file-name-sans-extension (expand-file-name input)))
|
||||
(expand-file-name
|
||||
(read-file-name
|
||||
(concat "To file (default " (file-name-nondirectory input) ") ")
|
||||
(format-prompt "To file" (file-name-nondirectory input))
|
||||
(file-name-directory input)
|
||||
input)))
|
||||
|
||||
@ -1236,9 +1236,7 @@ If no one is selected, symmetric encryption will be performed. ")
|
||||
(list keys
|
||||
(expand-file-name
|
||||
(read-file-name
|
||||
(concat "To file (default "
|
||||
(file-name-nondirectory default-name)
|
||||
") ")
|
||||
(format-prompt "To file" (file-name-nondirectory default-name))
|
||||
(file-name-directory default-name)
|
||||
default-name)))))
|
||||
(let ((context (epg-make-context epa-protocol)))
|
||||
|
@ -1100,7 +1100,7 @@ returned. Otherwise, DEFAULT is returned verbatim."
|
||||
;; prompt. If so, remove it.
|
||||
(setq prompt (replace-regexp-in-string ": ?\\'" "" prompt))
|
||||
(let ((prompt (if default
|
||||
(format-message "%s (default `%s'): " prompt default)
|
||||
(format-prompt prompt default)
|
||||
(format "%s: " prompt)))
|
||||
aliasfaces nonaliasfaces faces)
|
||||
;; Build up the completion tables.
|
||||
|
@ -320,7 +320,7 @@ If the format is not specified, attempt a regexp-based guess.
|
||||
Set `buffer-file-format' to the format used, and call any
|
||||
format-specific mode functions."
|
||||
(interactive
|
||||
(list (format-read "Translate buffer from format (default guess): ")))
|
||||
(list (format-read (format-prompt "Translate buffer from format" "guess"))))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(format-decode format (buffer-size) t)))
|
||||
@ -331,7 +331,7 @@ Arg FORMAT is optional; if omitted the format will be determined by looking
|
||||
for identifying regular expressions at the beginning of the region."
|
||||
(interactive
|
||||
(list (region-beginning) (region-end)
|
||||
(format-read "Translate region from format (default guess): ")))
|
||||
(format-read (format-prompt "Translate region from format" "guess"))))
|
||||
(save-excursion
|
||||
(goto-char from)
|
||||
(format-decode format (- to from) nil)))
|
||||
|
@ -3933,8 +3933,8 @@ This format is defined by the `gnus-article-time-format' variable."
|
||||
;; No split name was found.
|
||||
((null split-name)
|
||||
(read-file-name
|
||||
(concat prompt " (default "
|
||||
(file-name-nondirectory default-name) "): ")
|
||||
(format-prompt prompt
|
||||
(file-name-nondirectory default-name))
|
||||
(file-name-directory default-name)
|
||||
default-name))
|
||||
;; A single group name is returned.
|
||||
@ -3943,8 +3943,8 @@ This format is defined by the `gnus-article-time-format' variable."
|
||||
(funcall function split-name headers
|
||||
(symbol-value variable)))
|
||||
(read-file-name
|
||||
(concat prompt " (default "
|
||||
(file-name-nondirectory default-name) "): ")
|
||||
(format-prompt prompt
|
||||
(file-name-nondirectory default-name))
|
||||
(file-name-directory default-name)
|
||||
default-name))
|
||||
;; A single split name was found
|
||||
@ -3956,9 +3956,8 @@ This format is defined by the `gnus-article-time-format' variable."
|
||||
(file-name-as-directory name))
|
||||
((file-exists-p name) name)
|
||||
(t gnus-article-save-directory))))
|
||||
(read-file-name
|
||||
(concat prompt " (default " name "): ")
|
||||
dir name)))
|
||||
(read-file-name (format-prompt prompt name)
|
||||
dir name)))
|
||||
;; A list of splits was found.
|
||||
(t
|
||||
(setq split-name (nreverse split-name))
|
||||
|
@ -1310,9 +1310,7 @@ SPEC is a predicate specifier that contains stuff like `or', `and',
|
||||
initial-input history def)
|
||||
"Call `gnus-completing-read-function'."
|
||||
(funcall gnus-completing-read-function
|
||||
(concat prompt (when def
|
||||
(concat " (default " def ")"))
|
||||
": ")
|
||||
(format-prompt prompt def)
|
||||
collection require-match initial-input history def))
|
||||
|
||||
(defun gnus-emacs-completing-read (prompt collection &optional require-match
|
||||
|
@ -5349,7 +5349,7 @@ Otherwise, generate and save a value for `canlock-password' first."
|
||||
(zerop
|
||||
(length
|
||||
(setq to (completing-read
|
||||
"Followups to (default no Followup-To header): "
|
||||
(format-prompt "Followups to" "no Followup-To header")
|
||||
(mapcar #'list
|
||||
(cons "poster"
|
||||
(message-tokenize-header
|
||||
|
@ -2604,12 +2604,9 @@ new buffer."
|
||||
(if (eq (length completions) 1)
|
||||
(setq default (car completions)))
|
||||
(if completions
|
||||
(let ((input (completing-read (if default
|
||||
(concat
|
||||
"Follow reference named (default "
|
||||
default "): ")
|
||||
"Follow reference named: ")
|
||||
completions nil t)))
|
||||
(let ((input (completing-read (format-prompt "Follow reference named"
|
||||
default)
|
||||
completions nil t)))
|
||||
(list (if (equal input "")
|
||||
default input)
|
||||
current-prefix-arg))
|
||||
|
@ -833,7 +833,7 @@ The IGNORED argument is ignored."
|
||||
"Display information about a font whose name is FONTNAME."
|
||||
(interactive
|
||||
(list (completing-read
|
||||
"Font name (default current choice for ASCII chars): "
|
||||
(format-prompt "Font name" "current choice for ASCII chars")
|
||||
(and window-system
|
||||
;; Implied by `window-system'.
|
||||
(fboundp 'x-list-fonts)
|
||||
@ -1004,7 +1004,7 @@ This shows which font is used for which character(s)."
|
||||
(mapcar 'cdr fontset-alias-alist)))
|
||||
(completion-ignore-case t))
|
||||
(list (completing-read
|
||||
"Fontset (default used by the current frame): "
|
||||
(format-prompt "Fontset" "used by the current frame")
|
||||
fontset-list nil t)))))
|
||||
(if (= (length fontset) 0)
|
||||
(setq fontset (face-attribute 'default :fontset))
|
||||
|
@ -917,7 +917,7 @@ The format of KBD-LAYOUT is the same as `quail-keyboard-layout'."
|
||||
The variable `quail-keyboard-layout-type' holds the currently selected
|
||||
keyboard type."
|
||||
(interactive
|
||||
(list (completing-read "Keyboard type (default current choice): "
|
||||
(list (completing-read (format-prompt "Keyboard type" "current choice")
|
||||
quail-keyboard-layout-alist
|
||||
nil t)))
|
||||
(or (and keyboard-type (> (length keyboard-type) 0))
|
||||
|
@ -60,7 +60,7 @@ If the argument is nil, we return the display table to its standard state."
|
||||
(list
|
||||
(let* ((completion-ignore-case t))
|
||||
(completing-read
|
||||
"Cyrillic language (default nil): "
|
||||
(format-prompt "Cyrillic language" "nil")
|
||||
cyrillic-language-alist nil t nil nil nil))))
|
||||
|
||||
(or standard-display-table
|
||||
|
@ -74,12 +74,9 @@ according to the choice made, and returns a symbol."
|
||||
(rmail-summary-exists)
|
||||
(and (setq old (rmail-get-keywords))
|
||||
(mapc #'rmail-make-label (split-string old ", "))))
|
||||
(completing-read (concat prompt
|
||||
(if rmail-last-label
|
||||
(concat " (default "
|
||||
(symbol-name rmail-last-label)
|
||||
"): ")
|
||||
": "))
|
||||
(completing-read (format-prompt prompt
|
||||
(and rmail-last-label
|
||||
(symbol-name rmail-last-label)))
|
||||
rmail-label-obarray
|
||||
nil
|
||||
nil))))
|
||||
|
@ -254,7 +254,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 "Save as (default: %s): " filename)
|
||||
(read-file-name (format-prompt "Save as" filename)
|
||||
directory
|
||||
(expand-file-name filename directory))
|
||||
directory))
|
||||
|
@ -107,9 +107,8 @@ error: %S\n"
|
||||
(read-file
|
||||
(expand-file-name
|
||||
(read-file-name
|
||||
(concat "Output message to mail file (default "
|
||||
(file-name-nondirectory default-file)
|
||||
"): ")
|
||||
(format-prompt "Output message to mail file"
|
||||
(file-name-nondirectory default-file))
|
||||
(file-name-directory default-file)
|
||||
(abbreviate-file-name default-file))
|
||||
(file-name-directory default-file))))
|
||||
|
@ -1786,7 +1786,7 @@ Returns t if section is found, nil otherwise."
|
||||
Man--last-section
|
||||
(car Man--sections)))
|
||||
(completion-ignore-case t)
|
||||
(prompt (concat "Go to section (default " default "): "))
|
||||
(prompt (format-prompt "Go to section" default))
|
||||
(chosen (completing-read prompt Man--sections
|
||||
nil nil nil nil default)))
|
||||
(list chosen))
|
||||
@ -1850,7 +1850,7 @@ Specify which REFERENCE to use; default is based on word at point."
|
||||
(defaults
|
||||
(mapcar 'substring-no-properties
|
||||
(cons default Man--refpages)))
|
||||
(prompt (concat "Refer to (default " default "): "))
|
||||
(prompt (format-prompt "Refer to" default))
|
||||
(chosen (completing-read prompt Man--refpages
|
||||
nil nil nil nil defaults)))
|
||||
chosen)))
|
||||
|
@ -1918,10 +1918,7 @@ key, a click, or a menu-item"))
|
||||
(let* ((default (thing-at-point 'sexp))
|
||||
(topic
|
||||
(read-from-minibuffer
|
||||
(format "Subject to look up%s: "
|
||||
(if default
|
||||
(format " (default \"%s\")" default)
|
||||
""))
|
||||
(format-prompt "Subject to look up" default)
|
||||
nil nil nil nil default)))
|
||||
(list (if (zerop (length topic))
|
||||
default
|
||||
|
@ -1230,8 +1230,9 @@ only return the directory part of FILE."
|
||||
;; found another machine with the same user.
|
||||
;; Try that account.
|
||||
(read-passwd
|
||||
(format "passwd for %s@%s (default same as %s@%s): "
|
||||
user host user other)
|
||||
(format-prompt "passwd for %s@%s"
|
||||
(format "same as %s@%s" user other)
|
||||
user host)
|
||||
nil
|
||||
(ange-ftp-lookup-passwd other user))
|
||||
|
||||
|
@ -1815,10 +1815,13 @@ by their respective `org-store-link-plist' properties if present."
|
||||
;; Load history list for current prompt.
|
||||
(setq org-capture--prompt-history
|
||||
(gethash prompt org-capture--prompt-history-table))
|
||||
(push (org-completing-read
|
||||
(concat (or prompt "Enter string")
|
||||
(and default (format " [%s]" default))
|
||||
": ")
|
||||
(push (org-completing-read
|
||||
;; `format-prompt' is new in Emacs 28.1.
|
||||
(if (fboundp 'format-prompt)
|
||||
(format-prompt (or prompt "Enter string") default)
|
||||
(concat (or prompt "Enter string")
|
||||
(and default (format " [%s]" default))
|
||||
": "))
|
||||
completions
|
||||
nil nil nil 'org-capture--prompt-history default)
|
||||
strings)
|
||||
|
@ -640,11 +640,13 @@ this function appends the default value from
|
||||
org-refile-target-table))
|
||||
(completion-ignore-case t)
|
||||
cdef
|
||||
(prompt (concat prompt
|
||||
(or (and (car org-refile-history)
|
||||
(concat " (default " (car org-refile-history) ")"))
|
||||
(and (assoc cbnex tbl) (setq cdef cbnex)
|
||||
(concat " (default " cbnex ")"))) ": "))
|
||||
(prompt (let ((default (or (car org-refile-history)
|
||||
(and (assoc cbnex tbl) (setq cdef cbnex)
|
||||
cbnex))))
|
||||
;; `format-prompt' is new in Emacs 28.1.
|
||||
(if (fboundp 'format-prompt)
|
||||
(format-prompt prompt default)
|
||||
(concat prompt " (default " default ": "))))
|
||||
pa answ parent-target child parent old-hist)
|
||||
(setq old-hist org-refile-history)
|
||||
(setq answ (funcall cfunc prompt tbl nil (not new-nodes)
|
||||
|
@ -1772,8 +1772,8 @@ supported but discouraged. It will be removed in a future version of Emacs."
|
||||
`(:annotation-function
|
||||
,(lambda (s) (cdr (assoc s proced-signal-list))))))
|
||||
(proced-with-processes-buffer process-alist
|
||||
(list (completing-read (concat "Send signal [" pnum
|
||||
"] (default TERM): ")
|
||||
(list (completing-read (format-prompt "Send signal [%s]"
|
||||
"TERM" pnum)
|
||||
proced-signal-list
|
||||
nil nil nil nil "TERM")
|
||||
process-alist))))
|
||||
@ -1797,8 +1797,8 @@ supported but discouraged. It will be removed in a future version of Emacs."
|
||||
`(:annotation-function
|
||||
,(lambda (s) (cdr (assoc s proced-signal-list))))))
|
||||
(proced-with-processes-buffer process-alist
|
||||
(setq signal (completing-read (concat "Send signal [" pnum
|
||||
"] (default TERM): ")
|
||||
(setq signal (completing-read (format-prompt "Send signal [%s]"
|
||||
"TERM" pnum)
|
||||
proced-signal-list
|
||||
nil nil nil nil "TERM"))))))
|
||||
|
||||
|
@ -702,11 +702,8 @@ BRANCH should be either nil (false branch), t (true branch) or `both'."
|
||||
(x-popup-menu cpp-button-event
|
||||
(list prompt (cons prompt cpp-face-default-list)))
|
||||
(let ((name (car (rassq default cpp-face-default-list))))
|
||||
(cdr (assoc (completing-read (if name
|
||||
(concat prompt
|
||||
" (default " name "): ")
|
||||
(concat prompt ": "))
|
||||
cpp-face-default-list nil t)
|
||||
(cdr (assoc (completing-read (format-prompt "%s" name prompt)
|
||||
cpp-face-default-list nil t)
|
||||
cpp-face-all-list))))
|
||||
default))
|
||||
|
||||
|
@ -1330,9 +1330,9 @@ Pop to member buffer if no prefix ARG, to tree buffer otherwise."
|
||||
"Set the indentation width of the tree display."
|
||||
(interactive)
|
||||
(let ((width (string-to-number (read-string
|
||||
(concat "Indentation (default "
|
||||
(int-to-string ebrowse--indentation)
|
||||
"): ")
|
||||
(format-prompt
|
||||
"Indentation"
|
||||
(int-to-string ebrowse--indentation))
|
||||
nil nil ebrowse--indentation))))
|
||||
(when (cl-plusp width)
|
||||
(setq-local ebrowse--indentation width)
|
||||
|
@ -292,7 +292,7 @@ file the tag was in."
|
||||
(or (locate-dominating-file default-directory "TAGS")
|
||||
default-directory)))
|
||||
(list (read-file-name
|
||||
"Visit tags table (default TAGS): "
|
||||
(format-prompt "Visit tags table" "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 "Visit tags table (default TAGS): "
|
||||
(read-file-name (format-prompt "Visit tags table" "TAGS")
|
||||
default-directory
|
||||
"TAGS"
|
||||
t))))))
|
||||
|
@ -1057,11 +1057,9 @@ REGEXP is used as a string in the prompt."
|
||||
default-extension
|
||||
(car grep-files-history)
|
||||
(car (car grep-files-aliases))))
|
||||
(files (completing-read
|
||||
(concat "Search for \"" regexp
|
||||
"\" in files matching wildcard"
|
||||
(if default (concat " (default " default ")"))
|
||||
": ")
|
||||
(files (completing-read
|
||||
(format-prompt "Search for \"%s\" in files matching wildcard"
|
||||
default regexp)
|
||||
#'read-file-name-internal
|
||||
nil nil nil 'grep-files-history
|
||||
(delete-dups
|
||||
|
@ -2456,7 +2456,7 @@ This allows #ifdef VAR to be hidden."
|
||||
(t
|
||||
nil))))
|
||||
(var (read-minibuffer "Define what? " default))
|
||||
(val (read-from-minibuffer (format "Set %s to? (default 1): " var)
|
||||
(val (read-from-minibuffer (format-prompt "Set %s to?" "1" var)
|
||||
nil nil t nil "1")))
|
||||
(list var val)))
|
||||
(hif-set-var var (or val 1))
|
||||
|
@ -1357,9 +1357,7 @@ The default is a name found in the buffer around point."
|
||||
default ""))
|
||||
(label
|
||||
;; Do completion with default.
|
||||
(completing-read (if (not (string= default ""))
|
||||
(concat "Label (default " default "): ")
|
||||
"Label: ")
|
||||
(completing-read (format-prompt "Label" default)
|
||||
;; Complete with the defuns found in the
|
||||
;; current-buffer.
|
||||
(let ((buf (current-buffer)))
|
||||
|
@ -2484,11 +2484,8 @@ Interaction supports completion."
|
||||
(if (eq (try-completion default prolog-info-alist) nil)
|
||||
(setq default nil))
|
||||
;; Read the PredSpec from the user
|
||||
(completing-read
|
||||
(if (zerop (length default))
|
||||
"Help on predicate: "
|
||||
(concat "Help on predicate (default " default "): "))
|
||||
prolog-info-alist nil t nil nil default)))
|
||||
(completing-read (format-prompt "Help on predicate" default)
|
||||
prolog-info-alist nil t nil nil default)))
|
||||
|
||||
(defun prolog-build-info-alist (&optional verbose)
|
||||
"Build an alist of all builtins and library predicates.
|
||||
|
@ -4773,10 +4773,14 @@ Interactively, prompt for symbol."
|
||||
(interactive
|
||||
(let ((symbol (python-eldoc--get-symbol-at-point))
|
||||
(enable-recursive-minibuffers t))
|
||||
(list (read-string (if symbol
|
||||
(format "Describe symbol (default %s): " symbol)
|
||||
"Describe symbol: ")
|
||||
nil nil symbol))))
|
||||
(list (read-string
|
||||
;; `format-prompt' is new in Emacs 28.1.
|
||||
(if (fboundp 'format-prompt)
|
||||
(format-prompt "Describe symbol" symbol)
|
||||
(if symbol
|
||||
(format "Describe symbol (default %s): " symbol)
|
||||
"Describe symbol: "))
|
||||
nil nil symbol))))
|
||||
(message (python-eldoc--get-doc-at-point symbol)))
|
||||
|
||||
(defun python-describe-at-point (symbol process)
|
||||
|
@ -3219,14 +3219,7 @@ For both `:file' and `:completion', there can also be a
|
||||
symbol
|
||||
(let* ((default (plist-get plist :default))
|
||||
(last-value (sql-default-value symbol))
|
||||
(prompt-def
|
||||
(if default
|
||||
(if (string-match "\\(\\):[ \t]*\\'" prompt)
|
||||
(replace-match (format " (default \"%s\")" default) t t prompt 1)
|
||||
(replace-regexp-in-string "[ \t]*\\'"
|
||||
(format " (default \"%s\") " default)
|
||||
prompt t t))
|
||||
prompt))
|
||||
(prompt-def (format-prompt prompt default))
|
||||
(use-dialog-box nil))
|
||||
(cond
|
||||
((plist-member plist :file)
|
||||
@ -3311,7 +3304,7 @@ function like this: (sql-get-login \\='user \\='password \\='database)."
|
||||
(let ((plist (cdr-safe w)))
|
||||
(pcase (or (car-safe w) w)
|
||||
('user
|
||||
(sql-get-login-ext 'sql-user "User: " 'sql-user-history plist))
|
||||
(sql-get-login-ext 'sql-user "User" 'sql-user-history plist))
|
||||
|
||||
('password
|
||||
(setq-default sql-password
|
||||
@ -3330,14 +3323,14 @@ function like this: (sql-get-login \\='user \\='password \\='database)."
|
||||
(read-passwd "Password: " nil (sql-default-value 'sql-password)))))
|
||||
|
||||
('server
|
||||
(sql-get-login-ext 'sql-server "Server: " 'sql-server-history plist))
|
||||
(sql-get-login-ext 'sql-server "Server" 'sql-server-history plist))
|
||||
|
||||
('database
|
||||
(sql-get-login-ext 'sql-database "Database: "
|
||||
(sql-get-login-ext 'sql-database "Database"
|
||||
'sql-database-history plist))
|
||||
|
||||
('port
|
||||
(sql-get-login-ext 'sql-port "Port: "
|
||||
(sql-get-login-ext 'sql-port "Port"
|
||||
nil (append '(:number t) plist)))))))
|
||||
|
||||
(defun sql-find-sqli-buffer (&optional product connection)
|
||||
|
@ -5478,8 +5478,11 @@ becomes:
|
||||
(let* ((pop-up-windows t))
|
||||
(let ((name (expand-file-name
|
||||
(read-file-name
|
||||
(format "Find this error in: (default %s) "
|
||||
file)
|
||||
;; `format-prompt' is new in Emacs 28.1.
|
||||
(if (fboundp 'format-prompt)
|
||||
(format-prompt "Find this error in" file)
|
||||
(format "Find this error in (default %s): "
|
||||
file))
|
||||
nil ;; dir
|
||||
file t))))
|
||||
(setq buffer
|
||||
@ -7863,14 +7866,14 @@ If search fails, other files are checked based on
|
||||
(let* ((default (verilog-get-default-symbol))
|
||||
;; The following variable is used in verilog-comp-function
|
||||
(verilog-buffer-to-use (current-buffer))
|
||||
(label (if (not (string= default ""))
|
||||
;; Do completion with default
|
||||
(completing-read (concat "Goto-Label: (default "
|
||||
default ") ")
|
||||
#'verilog-comp-defun nil nil "")
|
||||
;; There is no default value. Complete without it
|
||||
(completing-read "Goto-Label: "
|
||||
#'verilog-comp-defun nil nil "")))
|
||||
(label
|
||||
(completing-read (cond ((fboundp 'format-prompt)
|
||||
;; `format-prompt' is new in Emacs 28.1.
|
||||
(format-prompt "Goto-Label" default))
|
||||
((not (string= default ""))
|
||||
(concat "Goto-Label (default " default "): "))
|
||||
(t "Goto-Label: "))
|
||||
#'verilog-comp-defun nil nil ""))
|
||||
pt)
|
||||
;; Make sure library paths are correct, in case need to resolve module
|
||||
(verilog-auto-reeval-locals)
|
||||
|
@ -1310,12 +1310,17 @@ definitions."
|
||||
(xref--prompt-p this-command))
|
||||
(let ((id
|
||||
(completing-read
|
||||
(if def
|
||||
(format "%s (default %s): "
|
||||
(substring prompt 0 (string-match
|
||||
"[ :]+\\'" prompt))
|
||||
def)
|
||||
prompt)
|
||||
;; `format-prompt' is new in Emacs 28.1
|
||||
(if (fboundp 'format-prompt)
|
||||
(format-prompt (substring prompt 0 (string-match
|
||||
"[ :]+\\'" prompt))
|
||||
def)
|
||||
(if def
|
||||
(format "%s (default %s): "
|
||||
(substring prompt 0 (string-match
|
||||
"[ :]+\\'" prompt))
|
||||
def)
|
||||
prompt))
|
||||
(xref-backend-identifier-completion-table backend)
|
||||
nil nil nil
|
||||
'xref--read-identifier-history def)))
|
||||
|
@ -3774,7 +3774,9 @@ function is redefined."
|
||||
(setq name (intern name))
|
||||
(let* ((cur-printer (gethash name ses--local-printer-hashmap))
|
||||
(default (and cur-printer (ses--locprn-def cur-printer))))
|
||||
(setq def (ses-read-printer (format "Enter definition of printer %S" name)
|
||||
(setq def (ses-read-printer (format-prompt
|
||||
"Enter definition of printer %S"
|
||||
default name)
|
||||
default)))
|
||||
(list name def)))
|
||||
|
||||
|
@ -2840,9 +2840,8 @@ Returns a list of strings."
|
||||
(if (memq system-type '(windows-nt ms-dos))
|
||||
(artist-figlet-get-font-list-windows)
|
||||
(artist-figlet-get-font-list)))
|
||||
(font (completing-read (concat "Select font (default "
|
||||
artist-figlet-default-font
|
||||
"): ")
|
||||
(font (completing-read (format-prompt "Select font"
|
||||
artist-figlet-default-font)
|
||||
(mapcar
|
||||
(lambda (font) (cons font font))
|
||||
avail-fonts))))
|
||||
|
@ -2457,7 +2457,7 @@ Only applies the FSPEC to the args part of FORMAT."
|
||||
(default (tex-compile-default fspec)))
|
||||
(list default-directory
|
||||
(completing-read
|
||||
(format "Command [%s]: " (tex-summarize-command default))
|
||||
(format-prompt "Command" (tex-summarize-command default))
|
||||
(mapcar (lambda (x)
|
||||
(list (tex-format-cmd (eval (car x) t) fspec)))
|
||||
tex-compile-commands)
|
||||
|
@ -96,15 +96,15 @@ Non-interactively, OLD and NEW may each be a file or a buffer."
|
||||
(interactive
|
||||
(let* ((newf (if (and buffer-file-name (file-exists-p buffer-file-name))
|
||||
(read-file-name
|
||||
(concat "Diff new file (default "
|
||||
(file-name-nondirectory buffer-file-name) "): ")
|
||||
(format-prompt "Diff new file"
|
||||
(file-name-nondirectory buffer-file-name))
|
||||
nil buffer-file-name t)
|
||||
(read-file-name "Diff new file: " nil nil t)))
|
||||
(oldf (file-newest-backup newf)))
|
||||
(setq oldf (if (and oldf (file-exists-p oldf))
|
||||
(read-file-name
|
||||
(concat "Diff original file (default "
|
||||
(file-name-nondirectory oldf) "): ")
|
||||
(format-prompt "Diff original file"
|
||||
(file-name-nondirectory oldf))
|
||||
(file-name-directory oldf) oldf t)
|
||||
(read-file-name "Diff original file: "
|
||||
(file-name-directory newf) nil t)))
|
||||
|
@ -503,15 +503,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
|
||||
(equal (expand-file-name dir)
|
||||
(file-name-directory buffer-file-name)))
|
||||
(concat
|
||||
" (default "
|
||||
(file-name-nondirectory buffer-file-name)
|
||||
")"))
|
||||
(t "")))
|
||||
(format-prompt "Patch is in file"
|
||||
(and buffer-file-name
|
||||
(equal (expand-file-name dir)
|
||||
(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)
|
||||
|
@ -3103,11 +3103,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
|
||||
(lambda () (when defaults
|
||||
(setq minibuffer-default defaults)))
|
||||
(read-file-name
|
||||
(format "%s%s "
|
||||
prompt
|
||||
(cond (default-file
|
||||
(concat " (default " default-file "):"))
|
||||
(t (concat " (default " default-dir "):"))))
|
||||
(format-prompt prompt (or default-file default-dir))
|
||||
default-dir
|
||||
(or default-file default-dir)
|
||||
t ; must match, no-confirm
|
||||
|
@ -1284,8 +1284,7 @@ marked instead. A directory can never be marked."
|
||||
(intern
|
||||
(upcase
|
||||
(completing-read
|
||||
(concat
|
||||
"Mark files in state" (if default (concat " [" default "]")) ": ")
|
||||
(format-prompt "Mark files in state" default)
|
||||
(mapcar (lambda (x)
|
||||
(list (downcase (symbol-name (car x)))))
|
||||
cvs-states)
|
||||
|
@ -1863,13 +1863,10 @@ Return t if the buffer had changes, nil otherwise."
|
||||
(vc-working-revision first))))
|
||||
(when (string= rev1-default "") (setq rev1-default nil))))
|
||||
;; construct argument list
|
||||
(let* ((rev1-prompt (if rev1-default
|
||||
(concat "Older revision (default "
|
||||
rev1-default "): ")
|
||||
"Older revision: "))
|
||||
(rev2-prompt (concat "Newer revision (default "
|
||||
;; (or rev2-default
|
||||
"current source): "))
|
||||
(let* ((rev1-prompt (format-prompt "Older revision" rev1-default))
|
||||
(rev2-prompt (format-prompt "Newer revision"
|
||||
;; (or rev2-default
|
||||
"current source"))
|
||||
(rev1 (vc-read-revision rev1-prompt files backend rev1-default))
|
||||
(rev2 (vc-read-revision rev2-prompt files backend nil))) ;; rev2-default
|
||||
(when (string= rev1 "") (setq rev1 nil))
|
||||
@ -2082,7 +2079,7 @@ If `F.~REV~' already exists, use it instead of checking it out again."
|
||||
(with-current-buffer (or (buffer-base-buffer) (current-buffer))
|
||||
(vc-ensure-vc-buffer)
|
||||
(list
|
||||
(vc-read-revision "Revision to visit (default is working revision): "
|
||||
(vc-read-revision (format-prompt "Revision to visit" "working revision")
|
||||
(list buffer-file-name)))))
|
||||
(set-buffer (or (buffer-base-buffer) (current-buffer)))
|
||||
(vc-ensure-vc-buffer)
|
||||
@ -2378,7 +2375,7 @@ This function runs the hook `vc-retrieve-tag-hook' when finished."
|
||||
(read-directory-name "Directory: " default-directory nil t))))
|
||||
(list
|
||||
dir
|
||||
(vc-read-revision "Tag name to retrieve (default latest revisions): "
|
||||
(vc-read-revision (format-prompt "Tag name to retrieve" "latest revisions")
|
||||
(list dir)
|
||||
(vc-responsible-backend dir)))))
|
||||
(let* ((backend (vc-responsible-backend dir))
|
||||
|
@ -3325,7 +3325,7 @@ It reads a file name from an editable text field."
|
||||
;;; (file (file-name-nondirectory value))
|
||||
;;; (menu-tag (widget-apply widget :menu-tag-get))
|
||||
;;; (must-match (widget-get widget :must-match))
|
||||
;;; (answer (read-file-name (concat menu-tag " (default " value "): ")
|
||||
;;; (answer (read-file-name (format-prompt menu-tag value)
|
||||
;;; dir nil must-match file)))
|
||||
;;; (widget-value-set widget (abbreviate-file-name answer))
|
||||
;;; (widget-setup)
|
||||
|
Loading…
Reference in New Issue
Block a user