如何创建右键上下文快捷方式“使用Emacs编辑”? [英] How to create a right-click context shell shortcut "edit with Emacs"?

查看:207
本文介绍了如何创建右键上下文快捷方式“使用Emacs编辑”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

记事本++会自动添加一个shell快捷方式,以便当您在Windows资源管理器中时,可以右击文件并选择使用记事本++编辑。我如何用emacs做同样的事情?我正在使用GNU Emacs 22.3 for Windows。

解决方案

这是我有的 - 类似于其他一些答案。在名为emacs-conextmenu.reg(或any-you-want.reg)的地方创建一个新的文本文件,并粘贴以下内容:

  Windows注册表编辑器版本5.00 

[HKEY_CLASSES_ROOT\ * \shell]
[HKEY_CLASSES_ROOT\ * \shell\openwemacs]
@ =& Edit与Emacs
[HKEY_CLASSES_ROOT\ * \shell\openwemacs\command]
@ =绝对\\Path \\\\\\\\\\\\\ \\bin\\emacsclientw.exe -n \%1\
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs]
@ =编辑&与Emacs
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs\command]
@ =绝对\\Path\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\bin\\emacsclientw.exe -n \%1\

更改您的emacs安装路径的路径;记住要逃避\(每当你有\,将其改为\\)。



现在您需要做的是双击浏览器中的* .reg文件,您将有一个用于任何文件和任何目录的emacs的上下文菜单条目请注意,为了正常工作,必须启动emacs,并且emacs-server也必须启动(Mx服务器启动) )。我建议使用Windows启动emacs并将(服务器启动)放在.emacs文件中。



作为奖金,以下自动快捷键片段( http:/ /www.autohotkey.com/ )将在Windows资源管理器中按ctrl-shift-enter启动在emacs中选择的文件。如果您在emacs中编辑大量文件,但不一定要导航到emacs中的文件,这可能会比较方便。

  #IfWinActive ahk_class CabinetWClass 
^ + Enter ::
GetText(tmpvar)
如果(tmpvar!=)
运行,d:/ path / to / your / emacs /bin/dir/emacsclientw.exe -n%tmpvar%
返回
返回


Notepad++ automatically adds a shell shortcut so that when you're in Windows Explorer, you can right-click on a file and select "edit with Notepad++". How can I do the same with emacs? I am using GNU Emacs 22.3 for Windows.

解决方案

Here's what I have - similar to some other answer. Create a new text file somewhere called emacs-conextmenu.reg (or anything-you-want.reg) and paste the following in:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shell\openwemacs]
@="&Edit with Emacs"
[HKEY_CLASSES_ROOT\*\shell\openwemacs\command]
@="Absolute\\Path\\to\\your\\emacs\\bin\\emacsclientw.exe -n \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs]
@="Edit &with Emacs"
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs\command]
@="Absolute\\Path\\to\\your\\emacs\\bin\\emacsclientw.exe -n \"%1\""

Change the path to your emacs installation path; remember to escape the "\" (whenever you have \, change that to \\).

Now all you need to do is double-click this *.reg file in the explorer and you shall have a context menu entry for emacs for any file and any directory (if you are a dired fan!).

Note that for this to work, emacs has to be started and emacs-server also has to be started (M-x server-start). I would suggest starting emacs with Windows and put (server-start) in your .emacs file.

As a bonus, the following snippet for autohotkey (http://www.autohotkey.com/) will start the file selected in emacs when you press ctrl-shift-enter in windows explorer. This might be more handy if you edit lots of files in emacs but does not necessarily want to navigate to the file in emacs itself.

#IfWinActive ahk_class CabinetWClass 
^+Enter::
  GetText(tmpvar)
  If (tmpvar != "")
     Run, d:/path/to/your/emacs/bin/dir/emacsclientw.exe -n "%tmpvar%"
Return
Return

这篇关于如何创建右键上下文快捷方式“使用Emacs编辑”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆