Open files in Emacs from the Cygwin command line
I just got this working today. The weirdnesses of Cygwin’s half Unix-half Windows nature had stymied me before, but I’ve prevailed!
I’ve got Gnu Emacs 23.3 for Windows installed in c:/emacs, and a fairly recent install of Cygwin on Windows 7.
Saved this script in ~/cygemacs.sh
#!/usr/bin/bash c:/emacs/bin/emacsclientw.exe -n -a "c:/emacs/bin/runemacs.exe" `cygpath -wa $@` |
Then in my ~/.bashrc:
alias ec="~/cygemacs.sh" |
Now I can be all like,
$ ec ~/.minttyrc |
And it opens a new frame in my running Emacs (I have (server-start)
in my ~/.emacs), or starts Emacs and opens the file if Emacs isn’t running yet.
See also: EmasClient at EmacsWiki.
Bonus tips
Yes I’m still using Subversion but also gitting going with Git.
And courtesy of The Lumber Room, in ~/.bashrc and others:
export SVN_EDITOR='c:/emacs/bin/emacsclientw.exe -a c:/emacs/bin/runemacs.exe ' |
And silence that annoying “kill client buffer z0mgbbq?!?” warning:
(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) |