>From 8d84b1bdfb2c974720cb3bff43a5114150422eca Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Wed, 10 Jan 2018 15:07:37 +0000 Subject: [PATCH 2/2] Simplify map-y-or-n-p help text logic (bug#30064) * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Use with-help-window instead of with-output-to-temp-buffer. Simplify string concatenation. --- lisp/emacs-lisp/map-ynp.el | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el index 5aa2a6fad1..dd80524a15 100644 --- a/lisp/emacs-lisp/map-ynp.el +++ b/lisp/emacs-lisp/map-ynp.el @@ -191,11 +191,11 @@ map-y-or-n-p (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 "\ @@ -205,20 +205,16 @@ map-y-or-n-p C-g to quit (cancel the whole command); ! to %s all remaining %s;\n" action object object objects action objects) - (mapconcat (function - (lambda (elt) - (format "%s to %s" - (single-key-description - (nth 0 elt)) - (nth 2 elt)))) + (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)) -- 2.15.1