마우스 오른쪽 버튼 클릭 컨텍스트 쉘 바로가기 "Emacs로 편집"을 만드는 방법은 무엇입니까?

StackOverflow https://stackoverflow.com/questions/455077

문제

Notepad++는 자동으로 쉘 바로가기를 추가하므로 Windows 탐색기에서 파일을 마우스 오른쪽 버튼으로 클릭하고 "Notepad++로 편집"을 선택할 수 있습니다.Emacs로 어떻게 동일한 작업을 수행할 수 있습니까?저는 Windows용 GNU Emacs 22.3을 사용하고 있습니다.

도움이 되었습니까?

해결책

내가 가진 것은 다음과 같습니다. 다른 답변과 유사합니다.emacs-conextmenu.reg(또는 everything-you-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에 대한 컨텍스트 메뉴 항목이 표시됩니다(만약 여러분이 열렬한 팬이라면!).

이것이 작동하려면 emacs가 시작되어야 하고 emacs-server도 시작되어야 합니다(M-x server-start).Windows에서 emacs를 시작하고 .emacs 파일에 (server-start)를 넣는 것이 좋습니다.

보너스로 다음 autohotkey 스니펫(http://www.autohotkey.com/) Windows 탐색기에서 Ctrl-Shift-Enter를 누르면 emacs에서 선택한 파일이 시작됩니다.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

다른 팁

Polyglot의 답변과 마찬가지로 서버 나 그 혼란을 시작할 필요는 없습니다.

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

레지스트리를 스펠링하지 않으면 Windows 탐색기 (EMAC뿐만 아니라 모든 편집자에 대한 지침)에서이를 수행 할 수 있습니다.

  1. Windows 탐색기를 열고 선택하십시오 Tools\Folder Options... 메뉴 아이템.

  2. 클릭하십시오 File Types 탭하고 편집기와 연결하려는 파일 유형의 확장자를 선택하십시오. 이 예에서는 txt 확장자를 사용하겠습니다.

  3. 클릭하십시오 Advanced 세부 사항 프레임의 버튼 Edit File Type 대화.

  4. 현재를 변경할 수 있습니다 open 조치 또는 새로운 동작을 지정합니다 Open with MyEditor.

    편집하기로 선택한 경우 Edit... 버튼과 Application used to peform action TextBox, 편집자에게 전체 경로를두고 "%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

설치 프로그램은 원하는 작업을 수행하는 Explorer 메뉴 항목을 만듭니다.

똑같은 일을하는 또 다른 방법이 있습니다. 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 디렉토리에 배치하십시오.

런칭 -EMACS-CLIENT.VBS

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 설치 프로그램 설치시 유사한 스크립트를 실행합니다.

위의 Polyglot의 답변에 추가하고 싶습니다.http://www.autohotkey.com/forum/viewtopic.php?p=279576#279576), 그리고 그건:

GetText(ByRef MyText = "")
{
   SavedClip := ClipboardAll
   Clipboard =
   Send ^c
   ClipWait 0.1
   If ERRORLEVEL
   {
      Clipboard := SavedClip
      MyText =
      ERRORLEVEL := 1
      Return
   }
   MyText := Clipboard
   Clipboard := SavedClip
   Return MyText
}

;to test: 
#k::
GetText(FileName)
msgbox clipboard=%FileName%
return

Clipwait 지연을 수정해야 할 수도 있습니다. 2로 설정해야했습니다!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top