using emacsclient

By Hal Canary, 2010-11-07 13:36:36 (link)
#computers-code

Attention Emacs users. It took me a while to realize that new-style fonts can be enabled by adding this to the ~/.emacs file.

(set-face-attribute 'default
  nil :font "Monospace-11")

So here's how I set up the look of Emacs in my .emacs:

(require 'color-theme)
(color-theme-dark-laptop)
(set-scroll-bar-mode 'right)
(tool-bar-mode nil)
(menu-bar-mode nil)
(set-face-attribute 'default
  nil :font "Monospace-11")

And here's my emacs startup script:

#!/bin/sh
#DTPD#
# ${HOME}/bin/e
if test "$DISPLAY" ; then
  nohup /usr/bin/emacsclient \
    -a '' -n  "$@" \
    > /dev/null 2>&1 &
else
  exec /usr/bin/emacs "$@"
fi

This startes emacs in daemon mode if it's not already running (there's not a lot of harm in leaving a daemon going in the background all the time) and then the client tell the daemon to spawn a new window to open the files mentioned in the command-line arguments. The "nohup" part deparents the server so you don't get error messages hitting your console.


(back)