From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: me@xenu.pl, emacs-devel@gnu.org
Subject: Re: [RFC] Option to kill `emacs --daemon' when closing the last client frame
Date: Thu, 21 Oct 2021 19:42:23 -0700 [thread overview]
Message-ID: <331355ff-0b5b-2e6b-6abd-639c80d74a1b@gmail.com> (raw)
In-Reply-To: <83h7daap1z.fsf@gnu.org>
On 10/20/2021 11:07 PM, Eli Zaretskii wrote:
>> From: Jim Porter <jporterbugs@gmail.com>
>> Date: Wed, 20 Oct 2021 13:07:02 -0700
>> Cc: emacs-devel@gnu.org
>>
>>> You will get that behaviour if you put (server-start) in your init.el
>>> and set --alternate-editor to the emacs binary, not just an empty string.
>>
>> Right, that's what I currently do. However, I've run into a couple
>> problems that have made me think `emacs --daemon' would be a better
>> solution. Under a non-daemon[1] configuration:
>>
>> 1) `org-protocol://' links don't work if Emacs isn't already running.
>> This is because org-protocol advises `server-visit-files' to detect when
>> a link with that protocol is passed as a file argument on the command
>> line. Since this argument is passed to the "alternate" Emacs, it's not
>> handled in `server-visit-files' and so the org-protocol code never runs.
>
> This sounds like a problem in org-protocol that should be solved
> there. If doing so requires some core feature we don't have, let's
> discuss that missing feature. But changing the behavior of the
> daemon, which will affect also all the other use cases unrelated to
> this one, is not TRT, IMO.
Agreed. Before I came across issue (2) below, my plan was simply to fix
this without changing the daemon's behavior. I think a core fix would be
generally useful though, and once I've looked into it more, I'll send a
message to the list with more thoughts.
>> 2) The first place Emacs is opened is the "primary" instance. This isn't
>> usually a problem when you only run Emacs graphically, but if mixing GUI
>> and terminal instances, it'd be nice to allow closing the first instance
>> and keep the others open. For example, if you start editing in a
>> terminal Emacs and open a GUI Emacs client, the GUI Emacs can only live
>> as long as the terminal one.
>
> I don't follow this one. What exactly do you mean by "primary" here,
> and what do you mean by "instance"? In the scenario you described
> there's only one instance of Emacs running, as I'm sure you know very
> well. Please elaborate.
I hope an example will illustrate what I mean[1]. I start with two
terminals open, A and B[2]. In terminal A, I run `emacs -nw foo.txt'. In
terminal B, I run `emacsclient -nw -c bar.txt'. Now, suppose I want to
stop editing foo.txt in terminal A and go back to doing something else.
I'd type `C-x C-c', but then my emacsclient in terminal B will close too.
However, using the daemon configuration with ALTERNATE_EDITOR="", I
could run `emacsclient -nw -c ...' in each terminal. Then when I type
`C-x C-c' in terminal A, it only kills that client, not the daemon
process. I can then continue to edit in terminal B without interruption.
Of course, this isn't a bug, it's just how emacs and emacsclient work
together when not using `emacs --daemon'. It just turned out to be
inconvenient for how I use Emacs, so I've moved to using `emacs
--daemon' instead.
- Jim
[1] It might be best to ignore my original terminology since it wasn't
very clear. However, for completeness, by "primary" I meant "the actual
`emacs' process", and by "instance" I meant "the set of frames
associated with a particular Emacs client, including 'no client'".
[2] This happens in a GUI too, but I think it's easier to see with
terminals.
next prev parent reply other threads:[~2021-10-22 2:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-20 4:20 [RFC] Option to kill `emacs --daemon' when closing the last client frame Jim Porter
2021-10-20 4:36 ` Tomasz Konojacki
2021-10-20 20:07 ` Jim Porter
2021-10-21 6:07 ` Eli Zaretskii
2021-10-22 2:42 ` Jim Porter [this message]
2021-10-22 6:41 ` Eli Zaretskii
2021-10-23 20:38 ` Jim Porter
2021-10-20 12:13 ` Eli Zaretskii
2021-10-21 3:43 ` Jim Porter
2021-10-21 7:34 ` Eli Zaretskii
2021-10-22 2:58 ` Jim Porter
2021-10-22 19:51 ` Gregor Zattler
2021-10-23 6:23 ` Eli Zaretskii
2021-10-23 7:45 ` Gregor Zattler
2021-10-23 8:23 ` Eli Zaretskii
2021-10-23 18:41 ` Gregor Zattler
2021-10-25 6:11 ` Jean Louis
2021-10-25 17:18 ` Jim Porter
2021-10-22 11:58 ` Stefan Monnier
2021-10-24 21:49 ` Jim Porter
2021-10-25 6:19 ` Jean Louis
2021-10-25 18:06 ` Jim Porter
2021-10-23 19:57 ` Gregory Heytings
2021-10-24 11:54 ` Gregory Heytings
2021-10-24 15:17 ` Gregory Heytings
2021-11-08 5:13 ` chad
2021-10-25 6:20 ` Jean Louis
2021-10-25 7:37 ` Gregory Heytings
-- strict thread matches above, loose matches on Subject: below --
2021-10-25 22:38 Peter Oliver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=331355ff-0b5b-2e6b-6abd-639c80d74a1b@gmail.com \
--to=jporterbugs@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=me@xenu.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.