Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Use emacsclient and don't close emacs server. Super fast startup (for emacs). There is a guide on emacswiki afaicr


sort by: page size:

Run emacs as a server when you start the machine and use emacsclient to connect with it. Way faster start times.

> Slow startup

Simply run Emacs in server mode - it's an operating system, so don't shut it down too often ;-)


Run emacs as a daemon and use emacsclient. Instant startup!

Use emacsclient and have a emacs server running at all times. Super fast startup times, you can even use emacsclient -nw (or make an alias 'e' for that) in the terminal for fast edits with instantaneous startup.

You could also make a script that starts emacs as a client only if a server already is running

  #!/bin/sh
  if [ "$#" -eq 0 ]
  then
    echo "Starting new Emacs process ..." >&2
    nohup emacs > /dev/null 2>&1 &
  elif emacsclient -n "$@" 2> /dev/null
  then
    echo "Opened $@ in Emacs server" >&2
  else
    echo "Opening $@ in a new Emacs process ..." >&2
    nohup emacs "$@" > /dev/null 2>&1 &
  fi
(Copied from an emacs starter kit but don't remember which...)

As a tip, if you enjoy quick startup times, you might want to try running emacs in daemon mode. Just fire up a emacs --daemon instance, and you can then use emacsclient to instantly connect to it.

Users who want fast startup simply load emacs-server once on system startup and run the emacsclient when needed. Emacs starts in a jiffy when done this way. Of course this probably will not help you with resetting accumulated states.

Run Emacs as a daemon/server and then connect with emacsclient in the terminal. Will start up in about the same time as Vim.

Why quit emacs when evil-mode exists?

Fast startup times are solved by never quitting emacs :) Really, emacsclient starts nearly instantly, and all the heavy stuff like language servers and emacs proper just run in server mode.

(Disclaimer: I know enough vi and often use it.)


Why would emacs ever be closed?

Anyway, if you run emacs as a server, you can connect to it with emacsclient in less than a second.

Even starting emacs from scratch can take less than a second, if your config is small enough or optimized enough.


Check out Doom Emacs for a fast startup time with no server.

alias ec='emacsclient --no-wait'

and add to your ~.emacs -> (server-start)


For the first point, use emacs service + emacsclient. Starts instantly.

Launch it in server mode at startup then use emacsclient: http://www.emacswiki.org/emacs/EmacsClient

Parent is talking about using "emacsclient". Basically you start Emacs in daemon mode (e.g. add "(server-start)" at end of config), and you never kill it. You just pay slow startup cost once, any subsequent client invocation after that is instantaneous.

Run `emacs -nw --daemon` to start a background emacs server.

Now, you can do `emacsclient -nw <file>` to boot up with almost no startup time. I have vi aliased to this, and `emacs -nw --daemon` opened by launchctl.

A gotcha: If you change your emacs config and need to restart, be sure to `pkill emacs` to get rid of the daemon.


You can also put (server-start) in your .emacs config.

The best way to run emacs IMO is to use "emacs --daemon" to spawn a single daemon process, and then connect to it using emacsclient. Then, startup time is instant!

Doom Emacs loads very fast so theoretically it's possible to configure Emacs to be fast too (mine starts in a second, cold start is a little slower).

But I think most people don't care about it enough because they either never close Emacs and/or use it in server-mode where emacsclient is pretty much instantaneous. Can I ask why you don't like doing that?


Use the emacs server then. Start once use many.
next

Legal | privacy