From 77a23c82f46b22ff3d7644bb31c51e0e319f0312 Mon Sep 17 00:00:00 2001 From: Jared Finder Date: Thu, 3 Dec 2020 22:42:05 -0800 Subject: [PATCH 1/4] Improve behavior for `make-help-screen' * lisp/help-macro.el (make-help-screen): Don't read just the ESC in a terminal escape sequence. Allow mouse wheel scroll of the help window. --- lisp/help-macro.el | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/lisp/help-macro.el b/lisp/help-macro.el index 791b10a878..15c17fdbdd 100644 --- a/lisp/help-macro.el +++ b/lisp/help-macro.el @@ -119,9 +119,16 @@ make-help-screen (let ((minor-mode-map-alist nil)) (setcdr local-map ,helped-map) (define-key local-map [t] 'undefined) - ;; Make the scroll bar keep working normally. - (define-key local-map [vertical-scroll-bar] - (lookup-key global-map [vertical-scroll-bar])) + ;; Make scrolling commands keep working normally. + (dolist (key '(;; Clicks in the scrollbar + [vertical-scroll-bar] + ;; Mouse wheel events + [mouse-4] [mouse-5] [down-mouse-4] + [down-mouse-5])) + (define-key local-map key (lookup-key global-map key))) + ;; Make terminal escape sequences be fully read as + ;; well. + (define-key local-map "\e" nil) (if three-step-help (progn (setq key (let ((overriding-local-map local-map)) @@ -148,8 +155,12 @@ make-help-screen (help-mode) (setq new-minor-mode-map-alist minor-mode-map-alist)) (goto-char (point-min)) - (while (or (memq char (append help-event-list - (cons help-char '(?? ?\C-v ?\s ?\177 delete backspace vertical-scroll-bar ?\M-v)))) + (while (or (memq (event-basic-type char) + (append help-event-list + (list help-char ?? ?\C-v ?\s ?\177 + 'delete 'backspace + 'vertical-scroll-bar + 'mouse-4 'mouse-5 ?\M-v))) (eq (car-safe char) 'switch-frame) (equal key "\M-v")) (condition-case nil @@ -171,9 +182,11 @@ make-help-screen "" ", or SPACE or DEL to scroll"))) char (aref key 0))) - ;; If this is a scroll bar command, just run it. - (when (eq char 'vertical-scroll-bar) - (command-execute (lookup-key local-map key) nil key)))) + ;; If this is a scroll bar or scroll wheel + ;; command, just run it. + (when (memq (event-basic-type char) + '(vertical-scroll-bar mouse-4 mouse-5)) + (command-execute (lookup-key local-map key) nil key)))) ;; We don't need the prompt any more. (message "") ;; Mouse clicks are not part of the help feature, -- 2.20.1