emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#36767: 26.1; request: add more quick keys to the *Help* buffer


From: Arthur Miller
Subject: Re: bug#36767: 26.1; request: add more quick keys to the *Help* buffer
Date: Sun, 26 Sep 2021 18:11:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

martin rudalics <rudalics@gmx.at> writes:

> here.+  (if (get-buffer-window (help-buffer))
> +      (let ((help-window (get-buffer-window (help-buffer))))
> +        (unless (window-dedicated-p help-window)
>
> Please use an idiom like
>
> (when (get-buffer "*Help*")
>   (let ((help-window (get-buffer-window "*Help*")))
>     (when help-window
>       ...
>
> instead.

I agree, but I don't like to see hardcoded *Help* string all over the place. I
don't think it will change in near future, if ever, but since I have used this
in several places, and plan to suggest some other commands for help buffer, I
think we can abstract it even further into something like this:

#+begin_src emacs-lisp
(defun help-window ()
  "Return help-buffer window or nil help-buffer is not currently displayed."
  (when (get-buffer "*Help*")
    (get-buffer-window (get-buffer "*Help*"))))

(defmacro with-help-buffer (&rest body)
  "Execute the forms in BODY with HELP-BUFFER temporarily current.

BODY will be executed onlu if HELP-BUFFER is displayed in a live
window on the screen."
  (declare (indent 1) (debug t))
  `(when (help-window)
    (with-current-buffer (help-buffer)
      ,@body)))
#+end_src

I see some problems with the latest patch I sent to Eli last night. I don't
understand why it worked last night, but does not work today :), but I have
probably had somewhere some state that I evaled, while I was tested.

I can add those two and rework patch to use them when I am done with it. It
loosk cleaner in those interactive commands.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]