1

I have installed Emacs 24 on my Mac using homebrew, and similar to another question (listed below), I would like to use the same command when first starting Emacs as I do when opening additional files from the command line. To this end, I have set up an alias (modified a bit for readability):

EAPP=/usr/local/Cellar/emacs/24.3/Emacs.app/Contents/MacOS
alias emacs='emacsclient -a $EAPP/Emacs -n'

Here's the twist: I put the -n (same as --no-wait) at the end because I like not having to hit C-x # to finish buffers. A side effect that I like is that it returns immediately to the command line.

Could there be a way to alter my alias to make the first-time run go in the background as well? Or should I just teach my fingers to put a & after every invocation of my emacs alias?

Question about making emacs and emacsclient seem the same:

Community
  • 1
  • 1
amacleod
  • 1,450
  • 2
  • 15
  • 23
  • 1
    I think most people use the daemon which can be launched without Emacs even being visible so there is no need to worry about an extra step to background it -- e.g., something like this: https://gist.github.com/ambethia/304964 – lawlist Feb 06 '14 at 23:37
  • 1
    I am not sure I understood you question correctly so pardon me I misunderstood something. Doesn't the following do what you want? `emacsclient -c -a='' -n `, this will check if server is running if not start it (`-a=''`), then start a new frame (`-c`) and returns immediately (`-n`). –  Feb 07 '14 at 05:39
  • @IqbalAnsari, when I tried the empty alternate editor (`-a=''`) emacsclient invoked the Apple-installed version of Emacs rather than the one I installed via homebrew. The alias I have above does mostly what I want, except that it doesn't go into the background the first time running. – amacleod Feb 07 '14 at 18:21
  • @lawlist, running the daemon at login sounds like it will work well for me. I'll give it a try. – amacleod Feb 07 '14 at 18:25
  • @amacleod the empty alternate editor starts the Apple-installed app because that is the emacs in the `PATH` variable, I remember facing this issue to resolve it add **prepend** `/usr/local/Cellar/emacs/24.3/Emacs.app/Contents/MacOS` to your path. –  Feb 08 '14 at 11:08

0 Answers0