summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorBasil L. Contovounesios <contovob@tcd.ie>2018-01-20 14:23:08 +0200
committerEli Zaretskii <eliz@gnu.org>2018-01-20 14:23:08 +0200
commitb54a86000c9519b2826ed2bf7f4475763c9b43f6 (patch)
tree475b6490743d0478ea8aca214c0157cf9c12032c /lisp/emacs-lisp
parent9e9b71189adaa559a7a6b2780ef25578980d9751 (diff)
downloademacs-b54a86000c9519b2826ed2bf7f4475763c9b43f6.tar.gz
emacs-b54a86000c9519b2826ed2bf7f4475763c9b43f6.tar.bz2
emacs-b54a86000c9519b2826ed2bf7f4475763c9b43f6.zip
Improve and simplify 'map-y-or-n-p'
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Do not follow a definite article with an action verb in C-h help text. Use 'with-help-window' instead of 'with-output-to-temp-buffer'. Simplify string concatenation. (Bug#30064)
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/map-ynp.el38
1 files changed, 17 insertions, 21 deletions
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index 2a7eddedad7..dd80524a152 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -191,34 +191,30 @@ Returns the number of actions taken."
(funcall actor elt)
(setq actions (1+ actions))))))
((eq def 'help)
- (with-output-to-temp-buffer "*Help*"
+ (with-help-window (help-buffer)
(princ
- (let ((object (if help (nth 0 help) "object"))
- (objects (if help (nth 1 help) "objects"))
- (action (if help (nth 2 help) "act on")))
+ (let ((object (or (nth 0 help) "object"))
+ (objects (or (nth 1 help) "objects"))
+ (action (or (nth 2 help) "act on")))
(concat
- (format-message "\
+ (format-message
+ "\
Type SPC or `y' to %s the current %s;
DEL or `n' to skip the current %s;
-RET or `q' to give up on the %s (skip all remaining %s);
+RET or `q' to skip the current and all remaining %s;
C-g to quit (cancel the whole command);
! to %s all remaining %s;\n"
- action object object action objects action
- objects)
- (mapconcat (function
- (lambda (elt)
- (format "%s to %s"
- (single-key-description
- (nth 0 elt))
- (nth 2 elt))))
+ action object object objects action objects)
+ (mapconcat (lambda (elt)
+ (format "%s to %s;\n"
+ (single-key-description
+ (nth 0 elt))
+ (nth 2 elt)))
action-alist
- ";\n")
- (if action-alist ";\n")
- (format "or . (period) to %s \
-the current %s and exit."
- action object))))
- (with-current-buffer standard-output
- (help-mode)))
+ "")
+ (format
+ "or . (period) to %s the current %s and exit."
+ action object)))))
(funcall try-again))
((and (symbolp def) (commandp def))