💾 Archived View for librehacker.com › gemlog › starlog › 20241011-0.gmi captured on 2024-12-17 at 10:19:57. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
I always view info manuals inside of Emacs, and there are about a dozen advantages to doing that. But one thing that I find annoying in the default Emacs configuration is that the info buffer name does not include the manual name. To clarify: the manual name is shown on the mode line, but it is not part of the buffer name itself. Consequently if you have multiple info buffers open — very common in my case — and you want to switch to the buffer you opened for the elisp manual, the buffer completion list might show something like *info*, *info<1>*, *info<2>*, which is not very helpful.
This snippet of elisp will but the info manual name — or, more precisely, the manual's file name — into the buffer name:
(add-hook 'Info-selection-hook (lambda () (rename-buffer (concat "*info " (replace-regexp-in-string "\\..*\\'" "" (file-name-nondirectory Info-current-file)) "*"))))
Caveat emptor: under some circumstances, like following a link from one manual to another manual, you might get an error related to buffer names. E.g., if you are in the Emacs manual and follow a link to the Elisp manual, but you already have another buffer open to the Elisp manual, you would get an error saying that the buffer name "*info elisp* is already in use. I imagine there are a few ways to fix this with some error handling, but I'm not sure if I'll get around to coding that.
This work © 2024 by Christopher Howard is licensed under Attribution-ShareAlike 4.0 International.