Fork me on GitHub
#spacemacs
<
2016-04-15
>
naartjie15:04:54

Mac users: how are you launching Spacemacs from command line? I found this gist https://gist.github.com/railwaycat/4043945 on Emacs Mac Port Readme, but not sure if that's the smoothest way. emacs --version doesn't work for example. But it does a good job or reusing the launched instance. (I still need to learn more about emacsclient and server)

naartjie15:04:37

I should probably say that I renamed Emacs_starter.pl to ~/bin/emacs and it's on my path

ag16:04:42

@naartjie: spacemacs supports emacs daemon, you don’t have to do anything… one thing though… os x comes with its emacsclient pre-installed. run which emacsclient and see where it’s pointing

ag16:04:40

and if you want to open file with emacsclient in the same frame, this little script might come handy: https://gist.github.com/agzam/cc723d45aa1ea73eadf63f866b0d3c01

akiva16:04:23

I’m kind of curious now: is it possible to get the non-CLI version to connect to an emacs daemon? I’d much rather have the daemon in the background and be able to connect to it from the shell and from the graphics app (which is what I use primarily).

ag17:04:40

@akiva as I said: Spacemacs supports daemon, you also have an option to keep it running when closing all frames. check dotspacemacs-persistent-server variable in .spacemacs

akiva17:04:10

@ag, I knew it does; I just wasn’t sure how to get the graphical client to connect to it.

ag17:04:03

@akiva if you installed Emacs app through brew, make sure that emacsclient points to the right one, not the one that’s pre-included in OS X

ag17:04:17

if you installed it via other means it should be in /Applications/Emacs.app/Contents/MacOS/bin/emacsclient

akiva17:04:18

@ag, right. But that’s for the command line only, isn’t it?

akiva17:04:35

(I installed through brew.)

ag17:04:20

@akiva emacsclient can open files in GUI. check the gist I posted earlier. I think the -c switch does the trick

akiva17:04:45

I’ll check that out.

akiva18:04:23

Unfortunately, no. It still opens Emacs in the shell.

naartjie19:04:02

@ag: Thanks for all that info. The ec.sh script in the gist works so long as I have Emacs.app (i.e. the GUI) launched already (via running open /Applications/Emacs.app), otherwise ec.sh opens the file inside the terminal. Should I just set up an alias start-emacs="open /Applications/Emacs.app" and run that when I start using emacs, then subsequently I can use ec.sh to open files after that?

ag19:04:03

honestly, usually when I run Emacs I keep in on all the time. that script could be modified to check if emacs already running. maybe using lsof -i | grep emacs or something else