Emacs 23, emacsclient arguments?

I recently installed Emacs 23 (on OS X Leopard) and tried the emacs server. I tried both ways: (1) put (server-start) in the .emacs file and (2) run emacs -daemon on the terminal (in separate tests, but not at the same time). In any case, when I already open the emacs frame and try to open a separate file in the OS X terminal using emacsclient -t, -tty or -nw, the file always opens in an existing frame, and not in the terminal, as described:

http://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html

http://emacs-fu.blogspot.com/2009/02/emacs-daemon.html

However, emacsclient -c works as expected. Do you have any idea what might happen?

Thanks a lot! -Stephen

+4
source share
4 answers

Thanks to everyone for your suggestions and answers - I think my solution is to add the following to my .bash_profile:

## --- emacs --- alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs' ## --- emacs client --- ## adapted from http://philipweaver.blogspot.com/2009/08/emacs-23.html # start a windowed frame alias ec="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -c -a /Applications/Emacs.app/Contents/MacOS/Emacs" # start a terminal frame alias em="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -t -a /Applications/Emacs.app/Contents/MacOS/Emacs -nw" # do not start a new frame alias ea="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -a /Applications/Emacs.app/Contents/MacOS/Emacs" 

I tried using emacs -daemon and replacing Emacs.app with the Emacs Client.app icon, as suggested

http://www.cubiclemuses.com/cm/articles/2009/07/30/emacs-23-for-os-x/

but (1) the daemon did not load many of my .emacs settings and (2) when I left Emacs Client, it will exit Emacs completely and will generate errors ...

So my solution is to use bash aliases as defined above; add the line, (server-start), to my .emacs file and add the Emacs.app icon to the OS X dock so that I can use either the icon or one of the aliases to start emacs and also open new files in executable instance, I can also use the aliases above or Cx Cf (or Cx b) in Emacs.

+5
source

Are you sure you are using the correct emacsclient binary? You will need /Applications/Emacs.app/Contents/MacOS/bin/emacsclient , and by default it will NOT be in your path. If you just call naked emacsclient from the command line, you will get emacsclient from Emacs 22.1, which Apple sends.

If you run emacsclient --version and get the following:

 $ emacsclient --version emacsclient 22.1 

You are not getting the right solution.

+5
source

If you installed the binary Emacs.app , you must use the executable inside the package. For instance:

 $ /Applications/Emacs.app/Contents/MacOS/Emacs -nw 

There is also a bin directory inside the package:

 $ cd /Applications/Emacs.app/Contents/MacOS/bin $ ls -la total 1488 drwxr-xr-x@ 19 ayman admin 646 Aug 16 02:33 . drwxr-xr-x@ 5 ayman admin 170 Aug 16 02:33 .. -rwxr-xr-x@ 1 ayman admin 39704 Aug 16 02:33 b2m -rwxr-xr-x@ 1 ayman admin 236412 Aug 16 02:33 ctags lrwxr-xr-x 1 ayman admin 18 Aug 24 12:54 cvtmail -> ../libexec/cvtmail lrwxr-xr-x 1 ayman admin 21 Aug 24 12:54 digest-doc -> ../libexec/digest-doc -rwxr-xr-x@ 1 ayman admin 122124 Aug 16 02:33 ebrowse -rwxr-xr-x@ 1 ayman admin 72188 Aug 16 02:33 emacsclient -rwxr-xr-x@ 1 ayman admin 232344 Aug 16 02:33 etags lrwxr-xr-x 1 ayman admin 19 Aug 24 12:54 fakemail -> ../libexec/fakemail -rwxr-xr-x@ 1 ayman admin 7288 Aug 16 02:26 grep-changelog lrwxr-xr-x 1 ayman admin 15 Aug 24 12:54 hexl -> ../libexec/hexl lrwxr-xr-x 1 ayman admin 19 Aug 24 12:54 movemail -> ../libexec/movemail lrwxr-xr-x 1 ayman admin 18 Aug 24 12:54 profile -> ../libexec/profile -rwxr-xr-x@ 1 ayman admin 3977 Aug 16 02:26 rcs-checkin lrwxr-xr-x 1 ayman admin 18 Aug 24 12:54 rcs2log -> ../libexec/rcs2log lrwxr-xr-x 1 ayman admin 21 Aug 24 12:54 sorted-doc -> ../libexec/sorted-doc lrwxr-xr-x 1 ayman admin 28 Aug 24 12:54 update-game-score -> ../libexec/update-game-score lrwxr-xr-x 1 ayman admin 17 Aug 24 12:54 vcdiff -> ../libexec/vcdiff $ 

If you run the entire command line, you can simply update your terminal using MacPort:

 $ sudo port install emacs-app 

which clicks emacs-app @23.0.0_NS-9.0rc3_1 since this post.

+2
source

I do not regularly use emacs on OS X, but I only started running emacs --daemon when I started the boot / window manager, keeping the process in the background. Isn't that an option?

I use the following alias in my * shrc files:

 EDITOR='emacsclient -t' alias e='emacsclient -n' alias ew='emacsclient -c -n' alias et='emacsclient -t' 

Although I have to admit that basically I create emacs frames from bindings in my window manager (you can think of QuickKeys or Quicksliver) that run: emacsclient -c -n or emacs -n -e '(make-remember-frame)' , which launches a new org-storage frame ...

Hope this helps.

+1
source

All Articles