diff --git a/.emacs.d/lisp/main.el b/.emacs.d/lisp/main.el index 6d5bbea3..68852e7c 100644 --- a/.emacs.d/lisp/main.el +++ b/.emacs.d/lisp/main.el @@ -280,7 +280,7 @@ (setq inferior-lisp-program "clisp") ;; Let Emacs auto-load/save sessions. -(when (and (fboundp 'server-running-p) (server-running-p)) +(when (getenv "EMACS_SERVER") (desktop-save-mode 1) (setq history-length 250) (setq desktop-dirname (concat emacs-cache-folder "desktop")) diff --git a/.emacs.d/lisp/theme.el b/.emacs.d/lisp/theme.el index 1dc7498a..391217b4 100644 --- a/.emacs.d/lisp/theme.el +++ b/.emacs.d/lisp/theme.el @@ -35,7 +35,7 @@ (set-face-bold-p 'error t)) ;; Blinking cursor is on only when Emacs is not daemonized. -(when (not (boundp 'server-running-p)) +(unless (getenv "EMACS_SERVER") (blink-cursor-mode -1)) ;; Line numbers. Graphic version has a gray bar separating text from line diff --git a/.scripts/em b/.scripts/em index 90d01af4..0a00b1cf 100755 --- a/.scripts/em +++ b/.scripts/em @@ -13,6 +13,9 @@ Calling script can have different names. * emc: emacs instance is opened in current terminal. * emw: if graphical, tell client to wait. +When starting the server, the EMACS_SERVER variable is set so that Emacs can +know in its initialization file whether the server is going to be started. + All emacsclient(1) options are supported. $(emacsclient --help) @@ -32,5 +35,5 @@ else fi fi -[ ! -e /tmp/emacs$(id -u)/server ] && emacs --daemon --no-site-file +[ ! -e /tmp/emacs$(id -u)/server ] && EMACS_SERVER=t emacs --daemon --no-site-file emacsclient $param "$@"