开发者

Reading multiple Emacs info files simultaneously

开发者 https://www.devze.com 2022-12-20 18:48 出处:网络
For reading progra开发者_C百科mming (and other) documentation, the Emacs INFO mode is outstanding.So outstanding that I would like to be able to read say, the Emacs Lisp info file and the org-mode inf

For reading progra开发者_C百科mming (and other) documentation, the Emacs INFO mode is outstanding. So outstanding that I would like to be able to read say, the Emacs Lisp info file and the org-mode info files simultaneously without traversing back up to the beginning of the info tree. Either I've missed something obvious or I will need to hack some Emacs Lisp to achieve the goal. And yet again, someone may have already cracked this nut. So I guess my question is: what is the state of the practice for reading mulitple INFO files in Emacs simultaneously?


If you look at the documentation for the 'info command (bound to C-h i by default), you'll find that you can easily create new *info* buffers with a numeric prefix.

C-u 1 C-h i
C-u 42 C-h i

That creates info buffers named *info*<1> and *info*<42>.

Documentation for the 'info command is (emphasis mine):

Enter Info, the documentation browser. Optional argument file-or-node specifies the file to examine; the default is the top-level directory of Info. Called from a program, file-or-node may specify an Info node of the form `(FILENAME)NODENAME'. Optional argument buffer specifies the Info buffer name; the default buffer name is info. If buffer exists, just switch to buffer. Otherwise, create a new buffer with the top-level Info directory.

In interactive use, a non-numeric prefix argument directs this command to read a file name from the minibuffer. A numeric prefix argument selects an Info buffer with the prefix number appended to the Info buffer name.

Also, by default, in the *info* buffer, M-n is bound to 'clone-buffer, which will create a new *info* buffer looking at the same page.


Just in case you want to brew your own cup using emacs lisp there is the function "generate-new-buffer-name" available:

This function returns a name that would be unique for a new buffer—but does not create the buffer. It starts with starting-name, and produces a name not currently in use for any buffer by appending a number inside of ‘<…>’. It starts at 2 and keeps incrementing the number until it is not the name of an existing buffer.

for example

(defun my-info-with-own-buffer ()
    (interactive)
    (info nil (generate-new-buffer-name "*info*")))

when invoked will open a fresh info buffer at the top directory node.

0

精彩评论

暂无评论...
验证码 换一张
取 消