Background:
I want to use emacs like tmux which can run as persistent session as well as shorten the time for me to start bringing up emacs when I want to (as inspired by these: Emacs and a Tmux replacement and Detaching and re-attaching to emacs server )
In my .profile, I tried to start emacs in daemon mode in the background, and it didn't start, and there was this message:
http://bugzilla.gnome.org/show_bug.cgi?id=85715
Emacs might crash when run in daemon mode and the X11 connection is unexpecedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
Then I start emacs with -Q --debug-init --daemon --with-x-toolkit=lucid
.
But the process hangs there as well as my logging in.
When I check with tty1, I see always 2 pairs of processes:
14183 ? Sl 0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
14187 ? Sl 0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
14132 ? S 0:00 /usr/bin/emacs -Q --debug-init --daemon --with-x-toolkit=lucid
14138 ? Ssl 0:00 /usr/bin/emacs -Q --debug-init --daemon --with-x-toolkit=lucid
And if I kill one of the emacs process (usually with the single S), then the other keyring-daemon process will disappear and I will be automatically brought back to the logon screen and the logon will be successful too. One examination with ps x
in the Xsession, there is only 1 emacs process and only 1 keyring process.
Questions:
What is happening so that the emacs startup hangs?
What can I do in my settings to make the emacs daemon startup nicely?
[I am using Emacs 25.1.1 on all most updated Devuan ASCII 2.1 distro (I know, my distro "Devuan" is so slow to update packages)]
Edit 1:
After I have fully started X and in XWindows environment, and if I do a $> killall emacs
first and make sure no emacs process is running, and then try starting the daemon with the same line. Here is the result:
My_User_Name@devux:~$ emacs --daemon
Warning: due to a long standing Gtk+ bug
bugzilla.gnome.org/show_bug.cgi?id=85715
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
(and then starting my site-list and then .emacs etc.)
Starting Emacs daemon.
My_User_Name@devux:~$ ps x | grep emacs
17553 ? Ssl 0:06 emacs --debug-init --daemon
18843 pts/0 S+ 0:00 grep --color=auto emacs
Edit 2: On further trial-and-error, I move the emacs --daemon
from .profile
to .xsessionrc
, and then to the startup tab of xfce4-session-settings
. And there is no hiccup for starting the daemon or for the login. I will investigate further for the actual reasons. [By the way, having the emacs daemon started does some convenience for me: my emacs startup time is beyond 12-15 seconds, and now with emacsclient -c -q, I can bring up a frame in less than a second and emacs serves also some functions like tmux in the background.]