18 January, 2011

Emacsclient Setup on Windows 7 Starter

Problem -- not starting a new instance of Emacs but reusing an Emacs already running when opening a file with a file type associated with Emacs in Windows Explorer on my netbook @home running Windows 7 Starter. I also wanted the icons of the associated file types to have the Emacs icon.

My quick fix to this was to
  • write a bat file, runemacsclientw.bat much like the example on the EmacsWiki to start emacsclientw.exe,
  • convert the bat file to exe with a simple converter,
    • choosed the above bat file as batch file,
    • checked Invisible application (don't know if this matters...),
    • under the Versioninformation tab picked an Emacs icon file from under the etc/icons path,
    • compiled, and exited,
  • fix read/execute permissions for the users group on the new exe file, runemacsclientw.exe, placed in the emacs bin directory
  • associate file types to be opened by Emacs with runemacsclientw.exe, and
  • add (server-start) to the Emacs init file, .emacs
Done, now I pinned a link to runemacsclientw.exe on the taskbar and defined an alias, emacs, for runemacsclientw.exe in my .bashrc. I run cygwin/bash on my Windows boxes.

6 comments:

  1. Why not just use emacsclientw.exe directly? What does the .bat file add?

    ReplyDelete
    Replies
    1. Using emacsclientw.exe directly does indeed solve his stated problem. On the other hand, a bat file adds something: passing some arguments automatically. The linked batch file for example adds --no-wait and --alternate-editor which you would want to pass to emacsclient most of the times. This is why also on Linux desktops, many users resort to a bash script or a desktop file that in turn calls emacsclient.

      Delete
  2. No Use, it just start a new emacs process not client with two window frames.
    If you use emacsclientw.exe it will be:
    Emacsclient ERROR
    No socket or alternate editor...

    ReplyDelete
    Replies
    1. This fixed it in my case (HOME not correctly defined before emacsclientw gets executed):
      http://lists.gnu.org/archive/html/help-gnu-emacs/2007-09/msg00675.html

      Delete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. Great and I have a super supply: Whole House Remodel Cost kitchen remodel companies near me

    ReplyDelete