help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] launching emacs


From: Gary Oberbrunner
Subject: Re: [h-e-w] launching emacs
Date: Fri, 11 May 2012 10:05:42 -0400 (EDT)

OK, after some experimentation and a lot of help from this list (THANKS!), I 
think I have a start at a decent Windows setup based on stock nightly Emacs (no 
W32).  This is basically my list of steps to replace the kinds of things an 
installer might do (or might offer to do).  There are a few questions 
intermixed here -- any suggestions appreciated.

There are at least four ways you may want to integrate Emacs into Windows:
 1. run from cmd window
 2. Start from shortcut (taskbar or Start menu)
 3. Double-click .txt/.el/.org files (or other extensions)
 4. set as editor for git/mercurial/etc.

First, for #1, put the emacs bin dir in the Windows PATH (right-click Computer, 
Properties, Advanced, Environment Variables).  This handles #1 and simplifies 
the other steps (no paths needed).

For #2, the right code for the desktop/task-bar shortcut is exactly this:
  emacsclientw.exe -na runemacs.exe -c
This shortcut will start emacs from scratch if it's not running, and open a new 
frame if it is.
The -c is key: without it, you have to pass a file to open (even if it's "", 
which does work but is uglier) or emacsclient will exit with an error.
(Right-click on desktop, New Shortcut, etc., then drag the shortcut into 
taskbar if you want.)

For #3, I don't have a good answer yet.  I know you start at Control Panel, 
Default Programs, Set Association, then  find .txt, .el, whatever you like.  
But how can you specify options to the program here?  I don't know how, without 
hand-editing the registry.
If you can figure it out though, you want to set those file types to open with:
  emacsclientw.exe -na runemacs.exe "%1"
I think the -n is optional because apparently emacsclientw never waits 
(contrary to the emacs wiki doc).
As long as your emacs server is already running, though, just using straight-up 
emacsclientw works OK here.

For #4, I don't know a general solution, but this almost works for me:
  git config --global core.editor "emacsclient -a runemacs '%*'"
The problem is, if emacs wasn't already running, it starts emacs fine, but it 
returns right away -- doesn't wait.  So the git commit fails (because the 
default message was unchanged).  Anyone know how to make emacsclient wait in 
the case where it has to start the alt editor?  (Do NOT use emacsclientw here; 
it doesn't wait.)


-- 
Gary Oberbrunner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]