GNU bug report logs -
#77118
31.0.50; help-key-binding face in help buffer
Previous Next
Reported by: Arash Esbati <arash <at> gnu.org>
Date: Wed, 19 Mar 2025 13:06:02 UTC
Severity: normal
Found in version 31.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Fri, 11 Apr 2025 14:46:10 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:
>> From: Stephen Berman <stephen.berman <at> gmx.net>
>> Cc: martin rudalics <rudalics <at> gmx.at>, stefankangas <at> gmail.com,
>> arash <at> gnu.org, monnier <at> iro.umontreal.ca, 77118 <at> debbugs.gnu.org
>> Date: Fri, 11 Apr 2025 12:23:55 +0200
>>
>> Is the patch below creative enough?
>>
>> Steve Berman
>>
>> diff --git a/lisp/help.el b/lisp/help.el
>> index b0c003ed16a..c7419b0d0ad 100644
>> --- a/lisp/help.el
>> +++ b/lisp/help.el
>> @@ -2190,8 +2190,11 @@ help-form-show
>> "Display the output of a non-nil `help-form'."
>> (let ((msg (eval help-form t)))
>> (if (stringp msg)
>> - (with-output-to-temp-buffer " *Char Help*"
>> - (princ msg)))))
>> + (let ((bufname " *Char Help*"))
>> + (with-output-to-temp-buffer bufname)
>> + (with-current-buffer bufname
>> + (let (buffer-read-only)
>> + (insert msg)))))))
>>
>> (defun help--append-keystrokes-help (str)
>> (let* ((keys (this-single-command-keys))
>
> Yes, if this does the job, it's much simpler and safer, IMO.
Ok.
> But let's see if anyone else has comments.
Sure.
> P.S. Why do we still need with-output-to-temp-buffer, if we just doing
> the 'insert' part inside the body?
It's with-output-to-temp-buffer that displays the buffer and insures
that it's content is up-to-date and also that the buffer is in Help mode
(the latter is done, IIUC, in the C code via
read_char_help_form_unwind). We can avoid with-output-to-temp-buffer
here with the following patch:
[Message part 2 (text/x-patch, inline)]
diff --git a/lisp/help.el b/lisp/help.el
index b0c003ed16a..6b591761177 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -2190,8 +2190,13 @@ help-form-show
"Display the output of a non-nil `help-form'."
(let ((msg (eval help-form t)))
(if (stringp msg)
- (with-output-to-temp-buffer " *Char Help*"
- (princ msg)))))
+ (let ((bufname " *Char Help*"))
+ (with-current-buffer (get-buffer-create bufname)
+ (let (buffer-read-only)
+ (erase-buffer)
+ (insert msg)
+ (help-mode)))
+ (display-buffer bufname)))))
(defun help--append-keystrokes-help (str)
(let* ((keys (this-single-command-keys))
[Message part 3 (text/plain, inline)]
I think this would also make some of the code in read_char that
processes the help character superfluous. Is it preferable to avoid
calling help-form-show from C?
Steve Berman
This bug report was last modified 65 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.