Notepad++ 自动添加 shell 快捷方式,以便当您在 Windows 资源管理器中时,可以右键单击文件并选择“使用 Notepad++ 编辑”。我怎样才能用 emacs 做同样的事情?我正在使用适用于 Windows 的 GNU Emacs 22.3。

有帮助吗?

解决方案

下面就是我 - 类似于其他一些答案。创建一个新的文本文件名为某处的emacs-conextmenu.reg(或任何任您want.reg)并粘贴到以下内容:

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\""

更改路径到emacs的安装路径;记得逃脱“\”(只要你有\,更改到\\)。

现在,所有你需要做的是在资源管理器中双击该* .reg文件,你必须有emacs的任何文件和任何目录上下文菜单项(如果你是一个dired球迷!)。

请注意,对于这个工作,emacs的必须启动和emacs服务器还必须启动(M-X服务器启动)。我会建议使用Windows启动Emacs和put(服务器启动)在你的.emacs文件。

作为奖励,下面的片段为AutoHotkey的( http://www.autohotkey.com/ )将开始在emacs的选择,当您按下Windows资源管理器CTRL移输入文件。如果编辑大量文件在Emacs,但不一定要导航到在Emacs本身的文件,这可能是更加得心应手。

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

其他提示

就像通晓多国语言的回答,但没必要启动服务器或任何乱七八糟的。

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shell\openwemacs]
@="&Edit with Emacs"
[HKEY_CLASSES_ROOT\*\shell\openwemacs\command]
@="C:\\Program Files (x86)\\Emacs\\bin\\emacsclientw.exe --alternate-editor=\"C:\\Program Files (x86)\\Emacs\\bin\\runemacs.exe\" -n \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs]
@="Edit &with Emacs"
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs\command]
@="C:\\Program Files (x86)\\Emacs\\bin\\emacsclientw.exe --alternate-editor=\"C:\\Program Files (x86)\\Emacs\\bin\\runemacs.exe\" -n \"%1\""

如果你不是为洞穴探险的注册表,你可以做这个从窗户资源管理器(说明任何编辑,而不仅仅是Emacs):

  1. 打开窗户资源管理器,并选择 Tools\Folder Options... 菜单的项目。

  2. 点击 File Types 选项和选择扩展类型的文件你想要与你的编辑。对这个例子中,我们将使用TXT扩展。

  3. Advanced 按钮在详细信息框架带来了 Edit File Type 对话。

  4. 你可以改变当前的 open 动作,或指定一个新的动作就像 Open with MyEditor.

    如果你选择编辑击 Edit... 按钮在 Application used to peform action 文本框,把全路径的编辑,接着 "%1".例如, C:\SciTe\wscite\SciTE.exe "%1".

    如果你想要创建一个新的行动,击 New... 按钮,给该行动的名称,并且得到完整的路径给你的编辑,接着 "%1".

  5. 如果你想让一个行动的默认对该文件的类型,选择的行动,然后点击 Set Default 按钮。

  6. OK 所有对话。

另一个选择将是把一个捷径给你的编辑的可执行你的 Send To 文件夹 %USERSPROFILE%\SendTo.我通常创建一个新的文件夹,在这里称为"编辑",并把快捷方式向各编辑我的使用。

通过一点点此外,还通过点击背景开口中的emacs当前目录成为可能。

<<<Code as posted by polyglot>>>

[HKEY_CLASSES_ROOT\Directory\Background\shell\openwemacs]
@="Open &with Emacs"
[HKEY_CLASSES_ROOT\Directory\Background\shell\openwemacs\command]
@="C:\\Program Files\\emacs-24.2\\bin\\runemacs.exe \"%V\""

下面%V为当前目录。使用%1不会在这种情况下工作。

这个网站 解释了如何使用其他应用程序执行此操作。只需更改路径即可。

创建此键/值:

[HKEY_CLASSES_ROOT\*\shell\Edit with AppName\command]
@=”\”C:\\Program Files\\Notepad2\\Notepad2.exe\” \”%1\”"

这是 另一个参考, ,这更容易理解。

查看与Windows集成Emacs的分布: http://ourcomments.org/Emacs/EmacsW32。 HTML

其安装程序创建一个资源管理器菜单项这你想要做什么。

这里是另一种方式做同样的事情。工作WinXP和Vista。

添加这个给你登记册:

编辑与emacs。reg

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Emacs]
@="Edit With &Emacs"
[HKEY_CLASSES_ROOT\*\shell\Emacs\command]
@="Wscript.exe C:\\emacs\\emacs-22.3\\bin\\launch-emacs-client.vbs \"%1\""

把这个文件在您的emacs bin directory:

启动emacs-客户。js

Set objShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

If WScript.Arguments.Count = 1 Then

  strComputer = "."

  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

  Set colItems = objWMIService.ExecQuery("Select * From Win32_Process")

  Dim isRunning
  isRunning = False

  For Each objItem in colItems
    If InStr(objItem.CommandLine, "emacs.exe") Then
      isRunning = True
    End If
  Next

  If isRunning Then
    objShell.Run(fso.GetParentFolderName(WScript.ScriptFullName) & "/emacsclientw.exe -n """ & WScript.Arguments(0) & """")
  Else
    objShell.Run(fso.GetParentFolderName(WScript.ScriptFullName) & "/runemacs.exe """ & WScript.Arguments(0) & """")
  End If

Else
  objShell.Run(fso.GetParentFolderName(WScript.ScriptFullName) & "/runemacs.exe")
End If

注:的 W32安装 运行一个类似的剧本上安装。

scroll top