11

Using C-h f and C-h v shows usefull help. Sometimes I want to compare information. So it would be useful to have more than one *Help* buffer, with different content, visible at the same time.

But always when using the shortcuts the content of the *Help* buffer gets overwritten.

How to have more than one help (*Help*) buffer open at the same time?

Drew
  • 75,699
  • 9
  • 109
  • 225
jue
  • 4,476
  • 8
  • 20

3 Answers3

7

You can use rename-uniquely. Go to the help buffer, call rename-uniquely. It renames the buffer to something like *Help*<2>. Now If you open another help buffer, it doesn't affect *Help*<2>.

(rename-uniquely)

Rename current buffer to a similar name not already taken.

fhdhsni
  • 693
  • 6
  • 16
  • This doesn't seem to be true with Emacs 28. Neither `rename-uniquely` nor `clone-buffer` retain their state after a new help topic is viewed. – wdkrnls Feb 25 '23 at 15:51
7

You can also use command/function clone-buffer.

M-x clone-buffer in buffer *Help* opens a new buffer *Help*<2> (or *Help*<3> if there is already a buffer *Help*<2>, etc.).

Same thing, if you use M-x clone-buffer in buffer *Help*<2>: you get *Help*<3> (or *Help*<4> if there is already a buffer *Help*<3>, etc.).

You can use clone-buffer pretty much anywhere. It's very useful in Info, for instance.


(This being said, personally I bind a key (C-M-S-<f1>) to rename-buffer, and I use that quite often. The default is the current buffer name, which I often want to edit only slightly for the new name.)

Drew
  • 75,699
  • 9
  • 109
  • 225
1

Thanks to the above answers, I wrote a small function which clones a help buffer on keypress.
Stuff both code snippets in you init.el to have it always available.

(defun jue-clone-buffer ()
        "jue clone current buffer. Useful to have multiple help buffers."
        (interactive)
        (clone-buffer (concat (buffer-name) "-"                 ; create name from old name and
                              (save-excursion                   ; use first word in buffer for new name
                                  (goto-char 0)
                                  (thing-at-point 'word t)))
                      t)))                                      ; show cloned buffer now

Bind the new function to key 'c' in help-mode:

(define-key help-mode-map (kbd "c") 'jue-clone-buffer)

Note:
You could use this function for other buffers also, not only *Help* buffers.
If you clone a buffer a second time, there is <N> appended to the name, where N is a number.

jue
  • 4,476
  • 8
  • 20