I have written about about using emacs in cygwin and how to launch emacs from cygwin, but I had some problems with the batch file approach in that emacs’ path differ from bash’s. Then ack fails to work from within emacs which makes me sad.

After googling around a bit, I saw a few suggestion that trie to fix the path in emacs, but I think a better approach is to launch emacs from within bash so it inherits the bash environment.

Here is my attempt using vbscript:

Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")

strCmd = "C:\cygwin\bin\bash --login -c '/usr/local/bin/emacsclient -c -a /usr/local/bin/emacs.exe"

    If WScript.Arguments.Count = 1 Then
        'strCmd = strCmd & " " &"""" & WScript.Arguments(0) & """'" 
		wScript.Echo strCmd
	else
		strCmd = strCmd & "'" 'close single quote
    End If

WinScriptHost.Run strCmd,0 
Set WinScriptHost = Nothing

Save that script somewhere and then make a Windows Shortcut to it but incle the wscript.exe in the target:

C:\Windows\System32\wscript.exe C:\Users\jason\launchemacs1.vbs

You can then launch it from the Start Menu in Windows 7.

Leave a comment

Your email address will not be published. Required fields are marked *