views:

78

answers:

0

Hi

I am trying to use desktop functionality (http://www.emacswiki.org/emacs/DeskTop) in emacs. I added following code to my .emacs:

(require 'desktop)
(setq desktop-save t)
(setq desktop-load-locked-desktop t)
(setq *desktop-dir* (list (expand-file-name "~/.emacs.d/desktop")))
(setq desktop-base-file-name ".emacs.desktop")
(setq desktop-path *desktop-dir*)
(setq desktop-dir *desktop-dir*)
(desktop-save-mode 1)
(desktop-read)

If I use emacs like a standalone application, calling like "$emacs -nw", everything is fine, but when I try to use the same config with emacsclient, emacs just hangs on server starting. Commenting out two last lines make emacs server start as expected.

See part of official Gentoo script from /etc/init.d to start emacs daemon.

: ${EMACS:=/usr/bin/emacs}
: ${EMACS_OPTS:=--daemon}
: ${EMACS_SHELL=/bin/bash}
: ${EMACS_START:=/usr/libexec/emacs/emacs-wrapper.sh}
: ${EMACS_TIMEOUT:=30}
: ${EMACS_SHUTDOWN_TIMEOUT:=10}
USER=${SVCNAME#*.}
PIDFILE_DIR=/var/run/emacs/${USER}
PIDFILE=${PIDFILE_DIR}/emacs.pid
...
local home
checkconfig || return 1

eval home="~${USER}"

SHELL=${EMACS_SHELL:-$(awk -F: "\$1 == \"${USER}\" { print \$7 }" \
    /etc/passwd)}
export SHELL EMACS EMACS_TIMEOUT

ebegin "Starting Emacs daemon for user ${USER}"
if [ -z "${RC_SVCNAME}" ]; then
    # baselayout-1
    start-stop-daemon --start \
        --user "${USER}" --exec "${EMACS}" --pidfile "${PIDFILE}" \
        --chuid "${USER}" --chdir "${home}" --env HOME="${home}" \
        --startas "${EMACS_START}" -- ${EMACS_OPTS}
else
    # OpenRC
    start-stop-daemon --start \
        --user "${USER}" --pidfile "${PIDFILE}" --chdir "${home}" \
        --exec "${EMACS_START}" -- ${EMACS_OPTS}
fi
eend $?

Is possible to debug emacsclient problems somehow? Maybe someone could give a hint?

P.S. I am on Gentoo Linux, emacs-vcs-23.2.9999 package, terminal only.