help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: closing man and help buffers


From: Eric Abrahamsen
Subject: Re: closing man and help buffers
Date: Mon, 19 Aug 2013 17:47:11 +0800
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux)

Luca Ferrari <fluca1978@infinito.it> writes:

> Hi all,
> this should be trivial, but I have not found a solution yet: often I
> open a man buffer (M-x man) or an help buffer (e.g., C-h something).
> The behavior is that the window splits and the buffer I was currently
> editing keeps the focus, so to close the other informational buffer I
> have to either use C-x C-b or switch to the buffer and kill it. Is
> there a smarter way to close such buffer (and only it) while keep the
> focus on the editing one? Something like "close the last opened
> buffer" could work.

The advice of the help buffer itself is to use "C-x 1" to get rid of it
-- since successive calls to help or man will reuse those buffers,
that's not too onerous. If you had more than one window to begin with,
of course, it's not nice as it will get rid of *all* the other windows.
I agree that some sort of "close utility window" command would be great,
and please God let it apply to the Quail Completion buffer as well.

Perhaps a fair solution would be a command that calls delete-window for
any buffer matching a list of regexps stored in (for example)
utility-buffer-names. Default to '("\\*Help\\*" "\\*Man*"
"\\*Apropos\\*" "\\*Quail Completions\\*) or something like that.

Untested code:

(defvar utility-buffer-names '("\\*Help\\*" "\\*Man" "\\*Apropos\\*"))

(defun kill-utility-windows ()
  (dolist (w (window-list))
    (dolist (b utility-buffer-names)
      (when (string-match-p b (buffer-name (window-buffer w)))
        (delete-window w))))) 

Probably too simplistic, but could be developed into something....

E




reply via email to

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