]> git.eshelyaron.com Git - emacs.git/commitdiff
Use format-prompt in calls to completing-read with a default value
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 6 Sep 2020 18:35:11 +0000 (20:35 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 6 Sep 2020 18:35:11 +0000 (20:35 +0200)
* lisp/textmodes/rst.el (rst-insert-list-new-item):
* lisp/tab-bar.el (tab-bar-switch-to-tab):
* lisp/profiler.el (profiler-start):
* lisp/frame.el (set-frame-font):
* lisp/erc/erc.el (erc-join-channel):
* lisp/emacs-lock.el (emacs-lock--set-mode):
* lisp/emacs-lisp/elp.el (elp-set-master):
* lisp/emacs-lisp/checkdoc.el ()
(checkdoc-this-string-valid-engine):
* lisp/calendar/todo-mode.el (todo-find-filtered-items-file):
* lisp/calendar/calendar.el (calendar-set-date-style): Use
`format-prompt' in calls to completing-read that has a default
value, but didn't mention that in the prompt.

lisp/calendar/calendar.el
lisp/calendar/todo-mode.el
lisp/emacs-lisp/checkdoc.el
lisp/emacs-lisp/elp.el
lisp/emacs-lock.el
lisp/erc/erc.el
lisp/frame.el
lisp/profiler.el
lisp/tab-bar.el
lisp/textmodes/rst.el

index 574261456fceff8bb924edb1fc57abc7a0833d4c..20887af48493985d79e7c2dd9492ab9c51201fe7 100644 (file)
@@ -994,7 +994,7 @@ pre-existing calendar windows."
   "Set the style of calendar and diary dates to STYLE (a symbol).
 The valid styles are described in the documentation of `calendar-date-style'."
   (interactive (list (intern
-                      (completing-read "Date style: "
+                      (completing-read (format-prompt "Date style" "american")
                                        '("american" "european" "iso") nil t
                                        nil nil "american"))))
   (or (memq style '(american european iso))
index 0e4446f77de5221257618b973de0f1e20903b1de..02a7316f26369f6bfa4f68dae5621dbfb0258313 100644 (file)
@@ -4076,7 +4076,9 @@ regexp items."
                        ((equal (file-name-extension f) "todt") "top")
                        ((equal (file-name-extension f) "tody") "diary"))))
        (push (cons (concat sf-name " (" type ")") f) falist)))
-    (setq file (completing-read "Choose a filtered items file: " falist nil t nil
+    (setq file (completing-read (format-prompt "Choose a filtered items file"
+                                               (caar falist))
+                                falist nil t nil
                                 'todo--fifiles-history (caar falist)))
     (setq file (cdr (assoc-string file falist)))
     (find-file file)
index 1029b52220d30c50c4cc0322bc45e5bd8628d169..23121c245ef2abf9256aced05ff2c1eda9d103fb 100644 (file)
@@ -1573,7 +1573,8 @@ mouse-[0-3]\\)\\)\\>"))
                     ;; a prefix.
                     (let ((disambiguate
                            (completing-read
-                            "Disambiguating Keyword (default variable): "
+                            (format-prompt "Disambiguating Keyword"
+                                            "variable")
                             '(("function") ("command") ("variable")
                               ("option") ("symbol"))
                             nil t nil nil "variable")))
index f68c0faf09de00504463adb06b31bc7401862e6d..a94978ac47be588d99824021f0ebcb86233494e0 100644 (file)
@@ -342,9 +342,9 @@ Use optional LIST if provided instead."
   (interactive
    (list
     (intern
-     (completing-read "Master function: " obarray
-                      #'elp--instrumented-p
-                      t nil nil (if elp-master (symbol-name elp-master))))))
+     (let ((default (if elp-master (symbol-name elp-master))))
+       (completing-read (format-prompt "Master function" default)
+                        obarray #'elp--instrumented-p t nil nil default)))))
   ;; When there's a master function, recording is turned off by default.
   (setq elp-master funsym
        elp-record-p nil)
index 5f393a01e8cb78e9abf2b32182d933cdc514504b..ba75a93035ed1d562213faddc87f17b2b3668d15 100644 (file)
@@ -176,11 +176,12 @@ Return a value appropriate for `kill-buffer-query-functions' (which see)."
                arg)
               ((and (eq arg current-prefix-arg) (consp current-prefix-arg))
                ;; called with C-u M-x emacs-lock-mode, so ask the user
-               (intern (completing-read "Locking mode: "
-                                        '("all" "exit" "kill")
-                                        nil t nil nil
-                                        (symbol-name
-                                         emacs-lock-default-locking-mode))))
+               (intern (completing-read
+                        (format-prompt "Locking mode"
+                                       emacs-lock-default-locking-mode)
+                        '("all" "exit" "kill")
+                        nil t nil nil
+                        (symbol-name emacs-lock-default-locking-mode))))
               ((eq mode t)
                ;; turn on, so use previous setting, or customized default
                (or emacs-lock--old-mode emacs-lock-default-locking-mode))
index 8712113790bc2be6c2c9ff50dcd2225f951767c0..e7e43f8734787eaadef4a53c4adff2e8e739c9e7 100644 (file)
@@ -4072,7 +4072,8 @@ If `point' is at the beginning of a channel name, use that as default."
           (table (when (erc-server-buffer-live-p)
                    (set-buffer (process-buffer erc-server-process))
                    erc-channel-list)))
-      (completing-read "Join channel: " table nil nil nil nil chnl))
+      (completing-read (format-prompt "Join channel" chnl)
+                       table nil nil nil nil chnl))
     (when (or current-prefix-arg erc-prompt-for-channel-key)
       (read-from-minibuffer "Channel key (RET for none): " nil))))
   (erc-cmd-JOIN channel (when (>= (length key) 1) key)))
index 70088545a68f918e27a5915c89be9b0bc84790aa..05da1ea7b8be98d0b1011291e7bfd8d6e96e384f 100644 (file)
@@ -1412,12 +1412,12 @@ as though the font-related attributes of the `default' face had been
 \"set in this session\", so that the font is applied to future frames."
   (interactive
    (let* ((completion-ignore-case t)
-         (font (completing-read "Font name: "
+          (default (frame-parameter nil 'font))
+         (font (completing-read (format-prompt "Font name" default)
                                 ;; x-list-fonts will fail with an error
                                 ;; if this frame doesn't support fonts.
                                 (x-list-fonts "*" nil (selected-frame))
-                                 nil nil nil nil
-                                 (frame-parameter nil 'font))))
+                                 nil nil nil nil default)))
      (list font current-prefix-arg nil)))
   (when (or (stringp font) (fontp font))
     (let* ((this-frame (selected-frame))
index 3243e6432f214073fea6965fccb461175198175b..0a5ddc1df46f51240622a5132ee463a8a2b53d4a 100644 (file)
@@ -816,7 +816,7 @@ If MODE is `cpu' or `cpu+mem', time-based profiler will be started.
 Also, if MODE is `mem' or `cpu+mem', then memory profiler will be started."
   (interactive
    (list (if (not (fboundp 'profiler-cpu-start)) 'mem
-           (intern (completing-read "Mode (default cpu): "
+           (intern (completing-read (format-prompt "Mode" "cpu")
                                     '("cpu" "mem" "cpu+mem")
                                     nil t nil nil "cpu")))))
   (cl-ecase mode
index cee88cb4275e077d44213f40b8f00ca38794e0ac..d8f932e7a4093890def15a67d654d16bc9810b9c 100644 (file)
@@ -665,7 +665,8 @@ to get the name of the last visited tab, the second last, and so on."
    (let* ((recent-tabs (mapcar (lambda (tab)
                                  (alist-get 'name tab))
                                (tab-bar--tabs-recent))))
-     (list (completing-read "Switch to tab by name (default recent): "
+     (list (completing-read (format-prompt "Switch to tab by name"
+                                           (car recent-tabs))
                             recent-tabs nil nil nil nil recent-tabs))))
   (tab-bar-select-tab (1+ (or (tab-bar--tab-index-by-name name) 0))))
 
index 5fadec491a5cbf71bf0f58683c07ee611a240f61..db17a90a716d30c4cc424f5da971eaa1da22ec88 100644 (file)
@@ -2363,7 +2363,7 @@ If user selects enumerations, a further prompt is given.  User need to
 input a starting item, for example 'e' for 'A)' style.  The position is
 also arranged by `rst-insert-list-new-tag'."
   (let* ((itemstyle (completing-read
-                    "Select preferred item style [#.]: "
+                    (format-prompt "Select preferred item style" "#.")
                     rst-initial-items nil t nil nil "#."))
         (cnt (if (string-match (rst-re 'cntexp-tag) itemstyle)
                  (match-string 0 itemstyle)))