Skip to content

Instantly share code, notes, and snippets.

@fire
Last active August 29, 2015 14:06
Show Gist options
  • Save fire/3721c3c0b5006f0c6c11 to your computer and use it in GitHub Desktop.
Save fire/3721c3c0b5006f0c6c11 to your computer and use it in GitHub Desktop.

Automatically open files in an existing window

Failed

  1. Add C:\Program Files (x86)\GNU Emacs 24.3\bin to path
  2. assoc .h=CodeFile
  3. ftype CodeFile="C:\Program Files (x86)\GNU Emacs 24.3\bin\emacsclientw.exe" -na "C:\Program Files (x86)\GNU Emacs 24.3\binrunemacs.exe" -c ""
  4. assoc .cpp=CodeFile
  5. assoc .c=CodeFile
  6. assoc .md=TextFile
  7. ftype TextFile="C:\Program Files (x86)\GNU Emacs 24.3\bin\emacsclientw.exe" -n --alternate-editor "C:\Program Files (x86)\GNU Emacs 24.3\bin\runemacs.exe" -c ""
  8. Create variable ALTERNATE_EDITOR and add C:\Program Files (x86)\GNU Emacs 24.3\bin\runemacs.exe
  9. "C:\Program Files (x86)\GNU Emacs 24.3\bin\emacsclientw.exe" -na "C:\Program" Files (x86)\GNU Emacs 24.3\bin\runemacs.exe" -c ""

Working

  1. git clone git://github.com/kjhealy/emacs-starter-kit ~/.emacs.d
  2. Add to init.el
  3. (load "server") (unless (server-running-p) (server-start))
  4. Open as "C:\Program Files (x86)\GNU Emacs 24.3\bin\emacsclientw.exe" -na "C:\Program Files (x86)\GNU Emacs 24.3\binrunemacs.exe" -c ""

Alternative

Open as "C:\ProgramData\chocolatey\lib\Emacs.24.3.0.20140722\tools\emacs-24.3\bin\emacsclientw.exe" -n --alternate-editor "C:\ProgramData\chocolatey\lib\Emacs.24.3.0.20140722\tools\emacs-24.3\bin\runemacs.exe" -c ""

Set: ALTERNATE_EDITOR to C:\ProgramData\chocolatey\lib\Emacs.24.3.0.20140722\tools\emacs-24.3\bin\runemacs.exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment