[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs server or daemon mode
From: |
Perry Smith |
Subject: |
Re: emacs server or daemon mode |
Date: |
Mon, 8 Jul 2019 18:44:19 -0500 |
Curious that no one replied to my original post. I tracked down one issue of
why emacs aborts when the X11 connection closes. Its due to this:
> #ifdef USE_GTK
> /* A long-standing GTK bug prevents proper disconnect handling
> (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once,
> the resulting Glib error message loop filled a user's disk.
> To avoid this, kill Emacs unconditionally on disconnect. */
> shut_down_emacs (0, Qnil);
> fprintf (stderr, "%s\n\
> When compiled with GTK, Emacs cannot recover from X disconnects.\n\
> This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\
> For details, see etc/PROBLEMS.\n",
> error_msg);
> emacs_abort ();
> #endif /* USE_GTK */
As a test, I commented that code and but emacs still dies. I didn’t track it
any further. Instead I switched to “Lucid” and the crash doesn’t happen.
If you look at the GTK bug report, it seems every six months or so another
Emacs uses bumps into the same issue.
The server-log and other issues I bumped into I probably won’t chase down.
Perry
> On Jul 7, 2019, at 4:00 PM, Perry Smith <pedz@easesoftware.com> wrote:
>
> My laptop is a Mac running the latest. I have an Ubuntu machine running
> 18.04. The Mac has emacs 26.1 that I built myself although at this point,
> its completely out of the picture. The Ubuntu machine now has emacs 26.2
> built by “KelleyK”. I also have the latest XQuatz on the Mac. XQuarts is an
> X11 port to the Mac.
>
> On the Ubuntu machine, my .emacs.d/init.el looks like this:
>
> (setq
> server-log t
> server-host "192.168.1.104"
> server-port "9999"
> server-use-tcp t)
>
> And I have enabed and started the systemd emacs.server (after slight editing)
> which now looks like this:
>
> ## If your Emacs is installed in a non-standard location, you may need
> ## to copy this file to a standard directory, eg ~/.config/systemd/user/ .
> ## If you install this file by hand, change the "Exec" lines below
> ## to use absolute file names for the executables.
> [Unit]
> Description=Emacs text editor
> Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
>
> [Service]
> Type=simple
> ExecStart=/usr/bin/emacs26 --fg-daemon
> ExecStop=/usr/bin/emacsclient26 --eval "(kill-emacs)"
> Environment=SSH_AUTH_SOCK=%t/keyring/ssh
> Restart=on-failure
>
> [Install]
> WantedBy=default.target
>
> On my Mac, I execute a command such as this (I’ve tried many variations):
>
> ssh -Y crystal /usr/bin/emacsclient26 -f server -c
>
> An X11 window pops up on my Mac display. For those who are not familiar,
> after installing XQuarts, the terminals have a DISPLAY set to a local socket.
> The ssh -Y propagates this to the other side and that is the socket that
> emacsclient is using to get back to my local display. All appears good.
> There is usually (not always) a message that says ^X 5 0 to close the window.
> I type this and the window disappears but the ssh does not exit.
>
> When I ^C the ssh, the emacs daemon on the Ubuntu host dies (and is restarted
> by systemd).
>
> One quest is to make the daemon not die even if the disconnect is abrupt but
> I can’t even find a way to gracefully exit or disconnect such that the ssh
> exits. The goal in this case is to use the Ubuntu machine and I’d like the
> build and the shell buffers that contain the build to survive a disconnect
> (graceful or abrupt).
>
> As you can see from my init file, I’ve tried getting the server log but the
> buffer is not created.
>
> Another tactic I’ve tried is to not only connect to the Ubuntu emacs server
> via the Mac but also ssh over and connect to it by running
>
> emacsclient26 -f server -nw
>
> from the prompt on the Ubuntu machine. From that terminal I do various
> things like print out server-clients … often it is correct but almost equally
> as often its not — showing fewer clients than are actually present. I show
> the buffers but there are only two *scratch* and *Messages* … no server log.
>
> With the ssh -Y emacsclient ..., I’ve tried -f and -t and with emacsclient
> I’ve tried -n. I’ve also tried redirecting stdin, stdout, and stderr to
> /dev/null or close them via <&-, etc.
>
> I’ve also tried removing the init.el file shown above. I was originally
> trying to do something different and wanted to use a TCP socket but at this
> point, that is no longer a requirement.
>
> I assume I must be doing something fundamentally wrong so I came to this
> group looking for help rather than the bug group.
>
> Thank you for your help,
> Perry
>