5 Matching Annotations
  1. Jan 2019
    1. If you are using an operating system that uses the systemd service manager (which nowadays includes most GNU/Linux distributions), then the best solution might be to use systemd to start your Emacs daemon on boot. You can do this by creating a file $HOME/.config/systemd/user/emacs.service with the following contents:

      $HOME/.config/systemd/user/emacs.service

    2. ‘-a COMMAND’ ‘--alternate-editor=COMMAND’ Specify a command to run if ‘emacsclient’ fails to contact Emacs. This is useful when running ‘emacsclient’ in a script. As a special exception, if COMMAND is the empty string, then ‘emacsclient’ starts Emacs in daemon mode (as ‘emacs --daemon’) and then tries connecting again. ‘-c’ ‘--create-frame’ Create a new graphical “client frame”, instead of using an existing Emacs frame. See below for the special behavior of ‘C-x C-c’ in a client frame. If Emacs cannot create a new graphical frame (e.g., if it cannot connect to the X server), it tries to create a text terminal client frame, as though you had supplied the ‘-t’ option instead. ‘-t’ ‘--tty’ ‘-nw’ Create a new client frame on the current text terminal, instead of using an existing Emacs frame. This behaves just like the ‘-c’ option, described above, except that it creates a text terminal frame (*note Non-Window Terminals::).

      ‘-a COMMAND’ ‘--alternate-editor=COMMAND’

      Specify a command to run if ‘emacsclient’ fails to contact Emacs. This is useful when running ‘emacsclient’ in a script.

      As a special exception, if COMMAND is the empty string, then ‘emacsclient’ starts Emacs in daemon mode (as ‘emacs --daemon’) and then tries connecting again.

      ‘-c’ ‘--create-frame’

      Create a new graphical “client frame”, instead of using an existing Emacs frame.

      See below for the special behavior of ‘C-x C-c’ in a client frame.

      If Emacs cannot create a new graphical frame (e.g., if it cannot connect to the X server), it tries to create a text terminal client frame, as though you had supplied the ‘-t’ option instead.

      ‘-t’ ‘--tty’ ‘-nw’

      Create a new client frame on the current text terminal, instead of using an existing Emacs frame.

      This behaves just like the ‘-c’ option, described above, except that it creates a text terminal frame (*note Non-Window Terminals::).

    3. I do this by starting an emacs daemon when I login. Where you put this command depends on your desktop manager. I use i3, which is configured to run a script on login that includes the following: emacs --daemon & With that, emacs is always running in the background, and I open a new client with emacsclient -c -n, bound to a convenient keybinding in the window manager. If you're working in a terminal, you only need a simple alias like alias emc='emacsclient', possibly with -n, -c or -t arguments, depending on how you use it. Do check out the options for emacsclient in the manual: ((emacs) emacsclient Options, accessible from Emacs by C-h r m emacsclient options <enter>). You can use the -a flag to automatically start an emacs daemon if it isn't running already, and -c or -t to open a new frame or terminal client, rather than reusing an existing one (in the same session):
    4. Since emacsclient can handle long package loading time proerly, I really want to keep at least one emacs process, and most of the time only one emacs process, open as a background process and better hide GUI. Right now I defined the following function in .bashrc: emc () { if [[ $# -eq 0 ]]; then emacs --eval "(suspend-frame)" & return fi args=($*); setsid emacsclient -c -e "(find-file \"${args[*]}\")" } And also have the following line in .bashrc: emc So everytime I open up a shell, I will end up having a new emacs process. The problem is I will have many additional unnecessary emacs process after opening up many shells. However, I only want to maintain one single emacs process all the time from startup better hide GUI.
    5. Emacsclient: One single emacs process all the time from start up & never close & better hide GUI