From: Emilio Lopes <eclig@gmx.net>
Subject: Patch: Follow convention for reading with the minibuffer.
Date: Tue, 06 Sep 2005 20:01:07 +0200 [thread overview]
Message-ID: <key86am5y4.fsf@tiscali.de> (raw)
Recently RMS documented in "(elisp)Programming Tips" a convention for
reading with the minibuffer:
* When you mention a default value in a minibuffer prompt, put it
and the word `default' inside parentheses. It should look like
this:
Enter the answer: (default 42)
Not all files in the Emacs sources follow this convention. The
following patch fixes the cases I could find with a simple grep.
I'm not sure whether blindly following such a convention is always a
Good Thing. For example:
Translate buffer from format (default: guess):
versus
Translate buffer from format: (default guess)
I double-checked these changes twice (sic). Nevertheless I would
appreciate if somebody else review this patch again before committing.
lisp/ChangeLog:
2005-09-06 Emilio C. Lopes <eclig@gmx.net>
* vc-mcvs.el (vc-mcvs-register):
* shadowfile.el (shadow-define-literal-group):
* progmodes/antlr-mode.el (antlr-end-of-rule):
* woman.el (woman-file-name):
* vc.el (vc-version-diff, vc-merge):
* textmodes/reftex-index.el (reftex-index-complete-tag):
* format.el (format-decode-buffer, format-decode-region):
* emulation/viper-cmd.el (viper-read-string-with-history):
* emacs-lisp/debug.el (cancel-debug-on-entry):
* emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* ediff.el (ediff-merge-revisions)
(ediff-merge-revisions-with-ancestor, ediff-revision):
* completion.el (interactive-completion-string-reader):
* calc/calc-prog.el (calc-user-define-formula): Follow convention
for reading with the minibuffer.
lisp/gnus/ChangeLog:
2005-09-06 Emilio C. Lopes <eclig@gmx.net>
* message.el (message-check-news-header-syntax): Follow convention
for reading with the minibuffer.
diff -rN -c old-emacs-darcs.eclig/lisp/calc/calc-prog.el new-emacs-darcs.eclig/lisp/calc/calc-prog.el
*** old-emacs-darcs.eclig/lisp/calc/calc-prog.el Tue Sep 6 19:35:56 2005
--- new-emacs-darcs.eclig/lisp/calc/calc-prog.el Mon Sep 5 20:23:23 2005
***************
*** 197,205 ****
(progn
(setq cmd-base-default (concat "User-" keyname))
(setq cmd (completing-read
! (concat "Define M-x command name (default: calc-"
cmd-base-default
! "): ")
obarray 'commandp nil
(if (and odef (symbolp (cdr odef)))
(symbol-name (cdr odef))
--- 197,205 ----
(progn
(setq cmd-base-default (concat "User-" keyname))
(setq cmd (completing-read
! (concat "Define M-x command name: (default calc-"
cmd-base-default
! ") ")
obarray 'commandp nil
(if (and odef (symbolp (cdr odef)))
(symbol-name (cdr odef))
***************
*** 233,240 ****
(setq func
(concat "calcFunc-"
(completing-read
! (concat "Define algebraic function name (default: "
! cmd-base-default "): ")
(mapcar (lambda (x) (substring x 9))
(all-completions "calcFunc-"
obarray))
--- 233,240 ----
(setq func
(concat "calcFunc-"
(completing-read
! (concat "Define algebraic function name: (default "
! cmd-base-default ") ")
(mapcar (lambda (x) (substring x 9))
(all-completions "calcFunc-"
obarray))
diff -rN -c old-emacs-darcs.eclig/lisp/completion.el new-emacs-darcs.eclig/lisp/completion.el
*** old-emacs-darcs.eclig/lisp/completion.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/completion.el Mon Sep 5 20:23:25 2005
***************
*** 1343,1349 ****
(let* ((default (symbol-under-or-before-point))
(new-prompt
(if default
! (format "%s: (default: %s) " prompt default)
(format "%s: " prompt)))
(read (completing-read new-prompt cmpl-obarray)))
(if (zerop (length read)) (setq read (or default "")))
--- 1343,1349 ----
(let* ((default (symbol-under-or-before-point))
(new-prompt
(if default
! (format "%s: (default %s) " prompt default)
(format "%s: " prompt)))
(read (completing-read new-prompt cmpl-obarray)))
(if (zerop (length read)) (setq read (or default "")))
diff -rN -c old-emacs-darcs.eclig/lisp/ediff.el new-emacs-darcs.eclig/lisp/ediff.el
*** old-emacs-darcs.eclig/lisp/ediff.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/ediff.el Tue Sep 6 19:06:42 2005
***************
*** 1261,1273 ****
(setq rev1
(read-string
(format
! "Version 1 to merge (default: %s's working version): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
rev2
(read-string
(format
! "Version 2 to merge (default: %s): "
(if (stringp file)
(file-name-nondirectory file) "current buffer"))))
(ediff-load-version-control)
--- 1261,1273 ----
(setq rev1
(read-string
(format
! "Version 1 to merge: (default %s's working version) "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
rev2
(read-string
(format
! "Version 2 to merge: (default %s) "
(if (stringp file)
(file-name-nondirectory file) "current buffer"))))
(ediff-load-version-control)
***************
*** 1293,1311 ****
(setq rev1
(read-string
(format
! "Version 1 to merge (default: %s's working version): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
rev2
(read-string
(format
! "Version 2 to merge (default: %s): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
ancestor-rev
(read-string
(format
! "Ancestor version (default: %s's base revision): "
(if (stringp file)
(file-name-nondirectory file) "current buffer"))))
(ediff-load-version-control)
--- 1293,1311 ----
(setq rev1
(read-string
(format
! "Version 1 to merge: (default %s's working version) "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
rev2
(read-string
(format
! "Version 2 to merge: (default %s) "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
ancestor-rev
(read-string
(format
! "Ancestor version: (default %s's base revision) "
(if (stringp file)
(file-name-nondirectory file) "current buffer"))))
(ediff-load-version-control)
***************
*** 1411,1421 ****
(let (rev1 rev2)
(setq rev1
(read-string
! (format "Revision 1 to compare (default: %s's latest revision): "
(file-name-nondirectory file)))
rev2
(read-string
! (format "Revision 2 to compare (default: %s's current state): "
(file-name-nondirectory file))))
(ediff-load-version-control)
(funcall
--- 1411,1421 ----
(let (rev1 rev2)
(setq rev1
(read-string
! (format "Revision 1 to compare: (default %s's latest revision) "
(file-name-nondirectory file)))
rev2
(read-string
! (format "Revision 2 to compare: (default %s's current state) "
(file-name-nondirectory file))))
(ediff-load-version-control)
(funcall
diff -rN -c old-emacs-darcs.eclig/lisp/emacs-lisp/checkdoc.el new-emacs-darcs.eclig/lisp/emacs-lisp/checkdoc.el
*** old-emacs-darcs.eclig/lisp/emacs-lisp/checkdoc.el Tue Sep 6 19:35:56 2005
--- new-emacs-darcs.eclig/lisp/emacs-lisp/checkdoc.el Tue Sep 6 19:06:42 2005
***************
*** 1585,1591 ****
;; a prefix.
(let ((disambiguate
(completing-read
! "Disambiguating Keyword (default: variable): "
'(("function") ("command") ("variable")
("option") ("symbol"))
nil t nil nil "variable")))
--- 1585,1591 ----
;; a prefix.
(let ((disambiguate
(completing-read
! "Disambiguating Keyword: (default variable) "
'(("function") ("command") ("variable")
("option") ("symbol"))
nil t nil nil "variable")))
diff -rN -c old-emacs-darcs.eclig/lisp/emacs-lisp/debug.el new-emacs-darcs.eclig/lisp/emacs-lisp/debug.el
*** old-emacs-darcs.eclig/lisp/emacs-lisp/debug.el Tue Sep 6 19:35:56 2005
--- new-emacs-darcs.eclig/lisp/emacs-lisp/debug.el Tue Sep 6 19:06:42 2005
***************
*** 754,760 ****
(interactive
(list (let ((name
(completing-read
! "Cancel debug on entry to function (default: all functions): "
(mapcar 'symbol-name debug-function-list) nil t)))
(when name
(unless (string= name "")
--- 754,760 ----
(interactive
(list (let ((name
(completing-read
! "Cancel debug on entry to function: (default all functions) "
(mapcar 'symbol-name debug-function-list) nil t)))
(when name
(unless (string= name "")
diff -rN -c old-emacs-darcs.eclig/lisp/emulation/viper-cmd.el new-emacs-darcs.eclig/lisp/emulation/viper-cmd.el
*** old-emacs-darcs.eclig/lisp/emulation/viper-cmd.el Tue Sep 6 19:35:56 2005
--- new-emacs-darcs.eclig/lisp/emulation/viper-cmd.el Tue Sep 6 19:06:42 2005
***************
*** 2154,2160 ****
(setq keymap (or keymap minibuffer-local-map)
initial (or initial "")
temp-msg (if default
! (format "(default: %s) " default)
""))
(setq viper-incomplete-ex-cmd nil)
--- 2154,2160 ----
(setq keymap (or keymap minibuffer-local-map)
initial (or initial "")
temp-msg (if default
! (format "(default %s) " default)
""))
(setq viper-incomplete-ex-cmd nil)
diff -rN -c old-emacs-darcs.eclig/lisp/format.el new-emacs-darcs.eclig/lisp/format.el
*** old-emacs-darcs.eclig/lisp/format.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/format.el Tue Sep 6 19:06:42 2005
***************
*** 316,322 ****
`buffer-file-format' is set to the format used, and any mode-functions
for the format are called."
(interactive
! (list (format-read "Translate buffer from format (default: guess): ")))
(save-excursion
(goto-char (point-min))
(format-decode format (buffer-size) t)))
--- 316,322 ----
`buffer-file-format' is set to the format used, and any mode-functions
for the format are called."
(interactive
! (list (format-read "Translate buffer from format: (default guess) ")))
(save-excursion
(goto-char (point-min))
(format-decode format (buffer-size) t)))
***************
*** 327,333 ****
for identifying regular expressions at the beginning of the region."
(interactive
(list (region-beginning) (region-end)
! (format-read "Translate region from format (default: guess): ")))
(save-excursion
(goto-char from)
(format-decode format (- to from) nil)))
--- 327,333 ----
for identifying regular expressions at the beginning of the region."
(interactive
(list (region-beginning) (region-end)
! (format-read "Translate region from format: (default guess) ")))
(save-excursion
(goto-char from)
(format-decode format (- to from) nil)))
diff -rN -c old-emacs-darcs.eclig/lisp/gnus/message.el new-emacs-darcs.eclig/lisp/gnus/message.el
*** old-emacs-darcs.eclig/lisp/gnus/message.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/gnus/message.el Tue Sep 6 19:06:42 2005
***************
*** 4197,4203 ****
(zerop
(length
(setq to (completing-read
! "Followups to (default: no Followup-To header) "
(mapcar #'list
(cons "poster"
(message-tokenize-header
--- 4197,4203 ----
(zerop
(length
(setq to (completing-read
! "Followups to: (default no Followup-To header) "
(mapcar #'list
(cons "poster"
(message-tokenize-header
diff -rN -c old-emacs-darcs.eclig/lisp/progmodes/antlr-mode.el new-emacs-darcs.eclig/lisp/progmodes/antlr-mode.el
*** old-emacs-darcs.eclig/lisp/progmodes/antlr-mode.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/progmodes/antlr-mode.el Tue Sep 6 19:08:15 2005
***************
*** 1410,1416 ****
(not (antlr-outside-rule-p)))))
(defunx antlr-end-of-rule (&optional arg)
! "Move forward to next end of rule. Do it ARG [default: 1] many times.
A grammar class header and the file prelude are also considered as a
rule. Negative argument ARG means move back to ARGth preceding end of
rule. If ARG is zero, run `antlr-end-of-body'."
--- 1410,1416 ----
(not (antlr-outside-rule-p)))))
(defunx antlr-end-of-rule (&optional arg)
! "Move forward to next end of rule. Do it ARG (default: 1) many times.
A grammar class header and the file prelude are also considered as a
rule. Negative argument ARG means move back to ARGth preceding end of
rule. If ARG is zero, run `antlr-end-of-body'."
diff -rN -c old-emacs-darcs.eclig/lisp/shadowfile.el new-emacs-darcs.eclig/lisp/shadowfile.el
*** old-emacs-darcs.eclig/lisp/shadowfile.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/shadowfile.el Tue Sep 6 19:11:02 2005
***************
*** 438,444 ****
(sit-for 2))
try-regexp))
; (username (read-no-blanks-input
! ; (format "Username [default: %s]: "
; (shadow-get-user primary))
; (if old (or (shadow-cluster-username old) "")
; (user-login-name))))
--- 438,444 ----
(sit-for 2))
try-regexp))
; (username (read-no-blanks-input
! ; (format "Username: (default %s) "
; (shadow-get-user primary))
; (if old (or (shadow-cluster-username old) "")
; (user-login-name))))
***************
*** 458,464 ****
(name (nth 2 hup))
user site group)
(while (setq site (shadow-read-site))
! (setq user (read-string (format "Username [default %s]: "
(shadow-get-user site)))
name (read-string "Filename: " name))
(setq group (cons (shadow-make-fullname site
--- 458,464 ----
(name (nth 2 hup))
user site group)
(while (setq site (shadow-read-site))
! (setq user (read-string (format "Username: (default %s) "
(shadow-get-user site)))
name (read-string "Filename: " name))
(setq group (cons (shadow-make-fullname site
diff -rN -c old-emacs-darcs.eclig/lisp/textmodes/reftex-index.el new-emacs-darcs.eclig/lisp/textmodes/reftex-index.el
*** old-emacs-darcs.eclig/lisp/textmodes/reftex-index.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/textmodes/reftex-index.el Tue Sep 6 19:06:42 2005
***************
*** 173,180 ****
(symbol-value reftex-docstruct-symbol))))
(default (reftex-default-index))
(prompt (concat "Index tag"
! (if default (format " (default: %s)" default) "")
! (if opt " (optional)" "") ": "))
(tag (completing-read prompt (mapcar 'list index-tags))))
(if (and default (equal tag "")) (setq tag default))
(reftex-update-default-index tag)
--- 173,180 ----
(symbol-value reftex-docstruct-symbol))))
(default (reftex-default-index))
(prompt (concat "Index tag"
! (if opt " (optional)" "") ":"
! (if default (format " (default %s)" default) "") " "))
(tag (completing-read prompt (mapcar 'list index-tags))))
(if (and default (equal tag "")) (setq tag default))
(reftex-update-default-index tag)
diff -rN -c old-emacs-darcs.eclig/lisp/vc-mcvs.el new-emacs-darcs.eclig/lisp/vc-mcvs.el
*** old-emacs-darcs.eclig/lisp/vc-mcvs.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/vc-mcvs.el Tue Sep 6 19:10:59 2005
***************
*** 225,231 ****
;; Make sure the `mcvs add' will not fire up the CVSEDITOR
;; to add a rule for the given file's extension.
(when (and ext (not (assoc ext types)))
! (let ((type (completing-read "Type to use [default]: "
'("default" "name-only" "keep-old"
"binary" "value-only")
nil t nil nil "default")))
--- 225,231 ----
;; Make sure the `mcvs add' will not fire up the CVSEDITOR
;; to add a rule for the given file's extension.
(when (and ext (not (assoc ext types)))
! (let ((type (completing-read "Type to use: (default) "
'("default" "name-only" "keep-old"
"binary" "value-only")
nil t nil nil "default")))
diff -rN -c old-emacs-darcs.eclig/lisp/vc.el new-emacs-darcs.eclig/lisp/vc.el
*** old-emacs-darcs.eclig/lisp/vc.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/vc.el Tue Sep 6 19:06:42 2005
***************
*** 1735,1741 ****
(read-string (if rev2-default
(concat "Newer version: (default "
rev2-default ") ")
! "Newer version (default: current source): ")
nil nil rev2-default))))
(if (file-directory-p file)
;; recursive directory diff
--- 1735,1741 ----
(read-string (if rev2-default
(concat "Newer version: (default "
rev2-default ") ")
! "Newer version: (default current source) ")
nil nil rev2-default))))
(if (file-directory-p file)
;; recursive directory diff
***************
*** 1997,2004 ****
(vc-checkout file t)
(error "Merge aborted"))))
(setq first-version
! (read-string (concat "Branch or version to merge from "
! "(default: news on current branch): ")))
(if (string= first-version "")
(if (not (vc-find-backend-function backend 'merge-news))
(error "Sorry, merging news is not implemented for %s" backend)
--- 1997,2004 ----
(vc-checkout file t)
(error "Merge aborted"))))
(setq first-version
! (read-string (concat "Branch or version to merge from: "
! "(default news on current branch) ")))
(if (string= first-version "")
(if (not (vc-find-backend-function backend 'merge-news))
(error "Sorry, merging news is not implemented for %s" backend)
diff -rN -c old-emacs-darcs.eclig/lisp/woman.el new-emacs-darcs.eclig/lisp/woman.el
*** old-emacs-darcs.eclig/lisp/woman.el Tue Sep 6 19:35:57 2005
--- new-emacs-darcs.eclig/lisp/woman.el Tue Sep 6 19:06:42 2005
***************
*** 1227,1233 ****
word-at-point)))
(completing-read
(if default
! (format "Manual entry [default: %s]: " default)
"Manual entry: ")
woman-topic-all-completions nil 1
nil
--- 1227,1233 ----
word-at-point)))
(completing-read
(if default
! (format "Manual entry: (default %s) " default)
"Manual entry: ")
woman-topic-all-completions nil 1
nil
next reply other threads:[~2005-09-06 18:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-06 18:01 Emilio Lopes [this message]
2005-09-06 20:01 ` Patch: Follow convention for reading with the minibuffer Stefan Monnier
2005-09-08 2:42 ` Richard M. Stallman
2005-09-08 6:54 ` Juri Linkov
2005-09-09 12:50 ` Richard M. Stallman
2005-09-09 16:05 ` Drew Adams
2005-09-09 17:13 ` Thien-Thi Nguyen
2005-09-09 18:20 ` Stefan Monnier
2005-09-11 13:52 ` Emilio Lopes
2005-09-24 13:52 ` Romain Francoise
2005-09-24 22:09 ` Thien-Thi Nguyen
2005-09-25 12:11 ` Juanma Barranquero
2005-09-29 20:57 ` Juri Linkov
2005-09-30 19:52 ` Stefan Monnier
2005-10-02 20:23 ` Juri Linkov
2005-09-29 20:59 ` Juri Linkov
2005-09-30 5:55 ` Romain Francoise
2005-09-30 17:34 ` Richard M. Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=key86am5y4.fsf@tiscali.de \
--to=eclig@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).