1

Hitting RET with point on a package name in the *Packages* buffer opens a help buffer, named "Help", describing the package. RET here invokes package-menu-describe-package which in turn calls describe-package which uses with-help-buffer to create this window. How can I customize the name of this buffer?

Pradhan
  • 2,330
  • 14
  • 28

1 Answers1

1

No, describe-package uses with-help-window (function/macro with-help-buffer does not exist).

And describe-package explicitly intends to show buffer *Help* in the help window, not another buffer. It purposely wants to replaces any current contents of buffer *Help*.

You should not try to make it use another buffer. If you really want to do that, then define your own command (e.g., based on the code of describe-package), and use that instead. You can, for example, remap the keys that are bound to describe-package to your command.

Alternatively, if all you want to do is change the name of the help buffer after it is created and shown, then just do that. Use command (function) rename-buffer - interactively or in Lisp code.

I bind rename-buffer to C-M-S-f1, and I use it quite often - in particular, to keep a *Help* buffer so that some help command does not overwrite its contents.

Drew
  • 75,699
  • 9
  • 109
  • 225
  • +1. I have `display-buffer-alist` customized to open all `*Help*` buffers in a particular frame and switch focus to it. However, I don't want to do this for a `*Help*` buffer spawned by `describe-package`. Changing the name would have been easy to handle with `display-buffer-alist`. I guess I should look at `defadvice`ing `describe-package`? – Pradhan Feb 11 '15 at 01:08
  • 1
    Why not just remap its keys to your own (similar) command? If you need to use something more than remapping (e.g., because of a particular keymap), consider `substitute-key-definition`. – Drew Feb 11 '15 at 02:52