unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Damien Cassou <damien@cassou.me>
To: 57816@debbugs.gnu.org
Subject: bug#57816: 28.2; Renaming a help buffer from help-mode-hook
Date: Thu, 15 Sep 2022 06:43:25 +0200	[thread overview]
Message-ID: <87leqlqmc2.fsf@cassou.me> (raw)

In GNU Emacs 28.2, I would like to automatically rename help buffers so
their name reflect their content. For example, I want *Help: car*
instead of just *Help* for the help buffer of `car'. Unfortunately,
adding #'rename-buffer to `help-mode-hook' doesn't work as this results
in 2 buffers instead of just one:

  emacs --batch -Q \
    --eval "(add-hook 'help-mode-hook (lambda () (rename-buffer \"*foo*\")))" \
    --eval "(describe-function #'describe-function)" \
    --eval "(prin1 (cons (get-buffer \"*Help*\") (get-buffer \"*foo*\")))"

prints

  (#<buffer *Help*> . #<buffer *foo*>)

After the "rename", there is still a buffer with the old name. Is there
a more correct way to do this?

Best

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill





             reply	other threads:[~2022-09-15  4:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15  4:43 Damien Cassou [this message]
2022-09-16 11:51 ` bug#57816: 28.2; Renaming a help buffer from help-mode-hook Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87leqlqmc2.fsf@cassou.me \
    --to=damien@cassou.me \
    --cc=57816@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).