summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2016-03-04 14:02:11 +0000
committerLars Ingebrigtsen <larsi@gnus.org>2016-03-04 15:33:38 +0000
commitcede502627415df2e5f30ad0f3600236f9603158 (patch)
treeff2fa225e88c3b7573361fcfad7e567ffb1a1c20
parent2d5b20f68c194e7fec7b9602935fd95149e9b7c6 (diff)
downloademacs-cede502627415df2e5f30ad0f3600236f9603158.tar.gz
Allow scrolling while querying multiple choice
* lisp/subr.el (read-multiple-choice): Allow scrolling the buffer while querying (bug#22827).
-rw-r--r--lisp/subr.el28
1 files changed, 27 insertions, 1 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 6eea54f2a32..7b0850f463f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2244,6 +2244,14 @@ might be shortened), and the third, optional entry is a longer
explanation that will be displayed in a help buffer if the user
requests more help.
+This function translates user input into responses by consulting
+the bindings in `query-replace-map'; see the documentation of
+that variable for more information. In this case, the useful
+bindings are `recenter', `scroll-up', and `scroll-down'. If the
+user enters `recenter', `scroll-up', or `scroll-down' responses,
+perform the requested window recentering or scrolling and ask
+again.
+
The return value is the matching entry from the CHOICES list.
Usage example:
@@ -2314,9 +2322,27 @@ Usage example:
(let ((cursor-in-echo-area t))
(read-char))
(error nil))))
+ (setq answer (lookup-key query-replace-map (vector tchar) t))
+ (setq tchar
+ (cond
+ ((eq answer 'recenter)
+ (recenter) t)
+ ((eq answer 'scroll-up)
+ (ignore-errors (scroll-up-command)) t)
+ ((eq answer 'scroll-down)
+ (ignore-errors (scroll-down-command)) t)
+ ((eq answer 'scroll-other-window)
+ (ignore-errors (scroll-other-window)) t)
+ ((eq answer 'scroll-other-window-down)
+ (ignore-errors (scroll-other-window-down)) t)
+ (t tchar)))
+ (when (eq tchar t)
+ (setq wrong-char nil
+ tchar nil))
;; The user has entered an invalid choice, so display the
;; help messages.
- (when (not (assq tchar choices))
+ (when (and (not (eq tchar nil))
+ (not (assq tchar choices)))
(setq wrong-char (not (memq tchar '(?? ?\C-h)))
tchar nil)
(when wrong-char