C-x C-f blah.info
会以fundamental模式打开文件。我使用了apropos
查找了一下,发现了Info-mode
,本以为可以从fundamental模式切换到Info模式,但是出现了Lisp错误。
我该如何在emacs中打开外部/第三方的*.info文件,以便可以像查看M-x info
时一样获得相同的功能(n
用于下一页,u
用于上一页,超链接等)?我确定这很明显,但我想不出来。
C-x C-f blah.info
会以fundamental模式打开文件。我使用了apropos
查找了一下,发现了Info-mode
,本以为可以从fundamental模式切换到Info模式,但是出现了Lisp错误。
我该如何在emacs中打开外部/第三方的*.info文件,以便可以像查看M-x info
时一样获得相同的功能(n
用于下一页,u
用于上一页,超链接等)?我确定这很明显,但我想不出来。
尝试使用C-u C-h i
(即,使用前缀参数的普通info调用)。
Plain(info `file-name')以info模式打开文件。(info)可能除了设置Info-mode之外还会做其他事情。因此,我会使用以下代码:
(defun info-mode () (interactive) (let ((file-name (buffer-file-name))) (kill-buffer (current-buffer)) (info file-name))) (add-to-list 'auto-mode-alist '("\\.info\\'" . info-mode))
info
主要作为info-setup
的跳板。这里有一个类似的函数,尽管没有原始info
函数的交互式语法糖:`(defun info-find-file (file)
(interactive "f")
(info-setup file
(pop-to-buffer-same-window
(format "*info*<%s>"
(file-name-sans-extension
(file-name-nondirectory file))))))`
- Sean Champ当鼠标指针悬停在目录缓冲区的文件名上时,请按下I
键(同时按下shift
和i
)。需要使用dired-x,它是GNU Emacs的一部分。
I运行命令dired-info, 它是`dired-x.el'中交互式编译的Lisp函数。 它被绑定到I上。 (dired-info)
运行此文件的信息。
(add-to-list 'auto-mode-alist '("\\.info\\'" . Info-on-current-buffer))
auto-mode-alist
配置通常会被 .info
文件忽略,因为它们在文件顶部有一个文件本地变量规范(如 -*-Text-*-
),这比 auto-mode-alist
配置优先级更高(参见 https://www.emacswiki.org/emacs/SetAutoMode )。我还没有找到通过按键绑定手动调用 Info-on-current-buffer
的替代方法。 - mindthiefM-x org-mode
的缓冲区中键入以下内容:info:path/to/blah
将光标放在此处,然后按下C-c C-o
来调用info。或者,您也可以使用鼠标单击它。如果您的路径包含空格,则还可以将整个内容设置为双方括号。
(setq auto-mode-alist
(append '(("\\.info" . Info-mode)) auto-mode-alist))
RET
键,否则没有任何链接是“活动的”。我认为 @rzab 是正确的,似乎 info 做了一些不仅仅是启动 Info-mode 的其他操作。感谢您的建议。 - UpgradingdaveC-u C-h i
这将提示您打开文件。 C-u
告诉交互式命令 info
请求一个参数,即文件名。