From 4b42e24835a76d625f865c67622143c0f58c55a4 Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Tue, 14 Apr 2015 14:17:08 +0100 Subject: [PATCH] Insert `help-char' if the help buffer is already shown * src/keyboard.c (read_char): Call `help-form-show' with the character that caused the function to be called. * lisp/help.el (help-form-show): If the temporary help window is already visible when called, insert the `help-char' that the user pressed. --- lisp/help.el | 15 +++++++++++---- src/keyboard.c | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/help.el b/lisp/help.el index fb1719a..cf134d5 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1339,11 +1339,18 @@ the help window if the current value of the user option ;; Called from C, on encountering `help-char' when reading a char. ;; Don't print to *Help*; that would clobber Help history. -(defun help-form-show () - "Display the output of a non-nil `help-form'." - (let ((msg (eval help-form))) +(defun help-form-show (char) + "Display the output of a non-nil `help-form'. If called while +`help-form' is being displayed, insert the help char." + (let* ((msg (eval help-form)) + (tmp-help-buf-name " *Char Help*") + (tmp-help-buf (get-buffer tmp-help-buf-name)) + (should-insert-char (and tmp-help-buf + (get-buffer-window tmp-help-buf)))) + (when should-insert-char + (insert-char char)) (if (stringp msg) - (with-output-to-temp-buffer " *Char Help*" + (with-output-to-temp-buffer tmp-help-buf-name (princ msg))))) diff --git a/src/keyboard.c b/src/keyboard.c index 068a47c..08c74e1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3188,7 +3188,7 @@ read_char (int commandflag, Lisp_Object map, = Fcons (Fcurrent_window_configuration (Qnil), help_form_saved_window_configs); record_unwind_protect_void (read_char_help_form_unwind); - call0 (Qhelp_form_show); + call1 (Qhelp_form_show, c); cancel_echoing (); do -- 2.3.5