Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用键盘快捷键在Emacs中打开对话框(打开文件…)_Emacs - Fatal编程技术网

使用键盘快捷键在Emacs中打开对话框(打开文件…)

使用键盘快捷键在Emacs中打开对话框(打开文件…),emacs,Emacs,在Emacs中,我没有使用与+链接的默认命令。因此,我想使用此键盘快捷键打开“打开文件…”的图形对话框。我应该如何进行设置?将以下内容放入.emacs文件中: (global-set-key (kbd "+") (lambda () (interactive) (let (last-nonmenu-event)

在Emacs中,我没有使用与+链接的默认命令。因此,我想使用此键盘快捷键打开“打开文件…”的图形对话框。我应该如何进行设置?

将以下内容放入
.emacs
文件中:

(global-set-key (kbd "+") (lambda ()
                            (interactive)
                            (let (last-nonmenu-event)
                              (menu-find-file-existing))))
然后键入M-x eval buffer或重新启动Emacs


然而-您真的绝对确定您永远不会需要+来完成任何其他事情(例如,插入
+
)?也许考虑使用至少类似CTRL+的东西作为你的键盘快捷键,而不仅仅是…这可以通过将上述代码片段中的
“+”
替换为
“C-+”

来轻松实现,类似于@Thomas的回答(关于使用
+
,我会提出同样的问题):

(全局设置键(kbd“+”)(lambda()
(互动)
(让(使用文件对话框)
(菜单“查找现有文件”))
不知道哪一个更好,也不知道这是否重要。但至少通过这种方式,您可能已经完成了
C-hv use file dialog
,以了解该变量的作用,以及为什么该代码会满足您的要求


menu find file existing
只是菜单栏
file
Open file…
绑定到的命令。单击该菜单项时,
C-hk
会告诉您这一点。)

谢谢您的类似回答!上面的一个稍微好一点,符合我的期望:)