4

I am starting to use "rename-uniquely" for help buffers so I can see multiple function helps at the same time.

However, what I get is:

 *Help*
 *Help*<2>
 *Help*<3>

etc

What I would like is:

 *Help*
 *Help*<f>-<compilation-find-file>
 *Help*<v>-<compilation-search-path>
  1. Does something similar exist?
  2. Is there an easy way to get properties from the help buffer? I am thinking the symbol that was requested, and the symbol type would be most useful.
Realraptor
  • 1,253
  • 6
  • 17
  • You can use `rename-buffer` to rename the buffer, but you'll have to provide the name explicitly. You might want to advise `rename-buffer` with a uniquification function. E.g. by default, in emacs-27 (at least - I haven't checked when it was added) `rename-buffer` is given an around-advice of `uniquify--rename-buffer-advice` which doesn't do what you want but is similar in spirit. You might want to check out [uniquify.el](http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/uniquify.el) which implements this function. – NickD Aug 12 '18 at 21:53
  • FWIW, I bind `rename-buffer` to a key. I like to give my own names to help buffers etc. – Drew Aug 13 '18 at 00:16
  • 1
    In that case, is there a better way to get the function or variable that a help buffer is displaying than using regular expressions? – Realraptor Aug 13 '18 at 00:57

1 Answers1

2

I don't see anything built-in for doing this, but the following might do what you need:

(defun get-help-name ()
  (save-excursion
    (goto-char 1)
    (thing-at-point 'symbol)))

(defun rename-help-buffer ()
  (interactive)
  (rename-buffer (concat "*Help: "
                         (get-help-name)
                         " *")))

I haven't included any logic to check to see that you're actually in a help buffer, or to add the v or f flags, but maybe that's enough, or enough to get you started.

Tyler
  • 21,719
  • 1
  • 52
  • 92