GNU bug report logs - #49195
Starting Emacs if required from emacsclient.desktop

Previous Next

Package: emacs;

Reported by: Peter Oliver <p.d.oliver <at> mavit.org.uk>

Date: Wed, 23 Jun 2021 20:00:01 UTC

Severity: normal

Tags: patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49195 in the body.
You can then email your comments to 49195 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#49195; Package emacs. (Wed, 23 Jun 2021 20:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Oliver <p.d.oliver <at> mavit.org.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 23 Jun 2021 20:00:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: Starting Emacs if required from emacsclient.desktop
Date: Wed, 23 Jun 2021 20:59:31 +0100 (BST)
[Message part 1 (text/plain, inline)]
At present, we provide emacs.desktop (which starts a new instance of Emacs), and emacsclient.desktop (which connects to an existing instance of Emacs).  This is problematic if a users wants to associate a particular file type with Emacs in their desktop file manager, because they can’t know in advance which will be correct.

Attached is a patch which enhances emacsclient.desktop so that it will start a new instance of Emacs if none is found to be running.  Users who like to reuse an existing Emacs can then always use emacsclient.desktop.

There was some discussion of how far to go with this on emacs-devel recently, but, if I understand correctly, the parts in this patch were not controversial.

-- 
Peter Oliver
[0001-From-.desktop-files-reuse-a-frame-or-start-a-new-Ema.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49195; Package emacs. (Thu, 24 Jun 2021 06:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 49195 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Peter Oliver <p.d.oliver <at> mavit.org.uk>
Cc: 49195 <at> debbugs.gnu.org
Subject: Re: bug#49195: Starting Emacs if required from emacsclient.desktop
Date: Thu, 24 Jun 2021 09:07:01 +0300
> Date: Wed, 23 Jun 2021 20:59:31 +0100 (BST)
> From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
> 
> Attached is a patch which enhances emacsclient.desktop so that it will start a new instance of Emacs if none is found to be running.  Users who like to reuse an existing Emacs can then always use emacsclient.desktop.

FWIW, I would find this change surprising, and therefore would suggest
to leave this off by default.  But that's me.

> There was some discussion of how far to go with this on emacs-devel recently, but, if I understand correctly, the parts in this patch were not controversial.

How do you understand that?  My recollection was that there was no
consensus on this, but my memory is not what it used to be.

> +  If you launch Emacs from a desktop environment, you may use the

"Desktop environment" is too general.  You mean GNU/Linux desktop
environment, and possibly just the ones compatible with
freedesktop.org?  The text should make that clear.

More generally, I'm not sure we should even say this in the Emacs
manual, as these features belong to the desktop, not to Emacs.  What
is the advantage of having this text in our manual?

> +*** New desktop integration for connecting to the server.
> +You may use the "Emacs (Client)" menu entry to open files in an
> +existing Emacs instance rather than starting a new one.

This isn't detailed enough, especially if we decide not to say
anything about that in the manual.  And even if we leave that text in
the manual, it is buried in a place where finding it isn't easy, so
NEWS should be more detailed.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49195; Package emacs. (Thu, 24 Jun 2021 13:29:02 GMT) Full text and rfc822 format available.

Message #11 received at 49195 <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 49195 <at> debbugs.gnu.org
Subject: Re: bug#49195: Starting Emacs if required from emacsclient.desktop
Date: Thu, 24 Jun 2021 14:28:29 +0100 (BST)
[Message part 1 (text/plain, inline)]
On Thu, 24 Jun 2021, Eli Zaretskii wrote:

>> Date: Wed, 23 Jun 2021 20:59:31 +0100 (BST)
>> From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
>>
>> Attached is a patch which enhances emacsclient.desktop so that it will start a new instance of Emacs if none is found to be running.  Users who like to reuse an existing Emacs can then always use emacsclient.desktop.
>
> FWIW, I would find this change surprising,

For someone to be unpleasantly surprised by this, they would need to launch emacsclient.desktop with the hope that it would fail because an Emacs daemon is not already running.  If they want it to fail, why would they try to launch it?

> and therefore would suggest to leave this off by default.  But that's me.

I’m not sure what off by default would mean in this context.  We’ll be providing emacsclient.desktop for the first time in Emacs 28, so users who prefer not to use it can carry on doing whatever they did before.

>> There was some discussion of how far to go with this on emacs-devel recently, but, if I understand correctly, the parts in this patch were not controversial.
>
> How do you understand that?  My recollection was that there was no
> consensus on this, but my memory is not what it used to be.

I thought that replacing emacs.desktop with emacsclient.desktop, so as to always use emacsclient, was the controversial part.  Apologies if I got that wrong.

>> +  If you launch Emacs from a desktop environment, you may use the
>
> "Desktop environment" is too general.  You mean GNU/Linux desktop
> environment, and possibly just the ones compatible with
> freedesktop.org?  The text should make that clear.

I’ve made this more specific.  Thanks.  A revised version of the patch is attached.

> More generally, I'm not sure we should even say this in the Emacs
> manual, as these features belong to the desktop, not to Emacs.

This section of the manual already describes how to start Emacs from systemd, which isn’t part of Emacs either.

> What is the advantage of having this text in our manual?

I think that providing two different .desktop files is confusing enough to be worth commenting on.

>> +*** New desktop integration for connecting to the server.
>> +You may use the "Emacs (Client)" menu entry to open files in an
>> +existing Emacs instance rather than starting a new one.
>
> This isn't detailed enough, especially if we decide not to say
> anything about that in the manual.  And even if we leave that text in
> the manual, it is buried in a place where finding it isn't easy, so
> NEWS should be more detailed.

I’ve expanded this, but please let me know if you think there’s anything else that needs to be explained or isn’t clear; I’m aware that things that are obvious to the person who wrote a feature may not be obvious to others, but it’s hard to know exactly what.

-- 
Peter Oliver
[0001-From-.desktop-files-reuse-a-frame-or-start-a-new-Ema.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49195; Package emacs. (Thu, 24 Jun 2021 14:23:02 GMT) Full text and rfc822 format available.

Message #14 received at 49195 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Peter Oliver <p.d.oliver <at> mavit.org.uk>
Cc: 49195 <at> debbugs.gnu.org
Subject: Re: bug#49195: Starting Emacs if required from emacsclient.desktop
Date: Thu, 24 Jun 2021 17:22:02 +0300
> Date: Thu, 24 Jun 2021 14:28:29 +0100 (BST)
> From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
> cc: 49195 <at> debbugs.gnu.org
> 
> > FWIW, I would find this change surprising,
> 
> For someone to be unpleasantly surprised by this, they would need to launch emacsclient.desktop with the hope that it would fail because an Emacs daemon is not already running.  If they want it to fail, why would they try to launch it?

Because they don't remember whether they did or didn't start a server?
Happens to me from time to time.

> > and therefore would suggest to leave this off by default.  But that's me.
> 
> I’m not sure what off by default would mean in this context.

What it is now.

> > More generally, I'm not sure we should even say this in the Emacs
> > manual, as these features belong to the desktop, not to Emacs.
> 
> This section of the manual already describes how to start Emacs from systemd, which isn’t part of Emacs either.

systemd support code is in emacs.c, so that is (borderline) okay.
What you describe is just normal desktop invocation, AFAIU.

> +  If your operating system’s desktop environment is
> +@url{https://www.freedesktop.org/wiki/Specifications/,,freedesktop.org-compatible}
> +(which is true of most GNU/Linux and other recent Unix-like GUIs), you
> +may use the @dfn{Emacs (Client)} menu entry to connect to an Emacs

It is wrong to use @dfn here, since this is not new terminology you
are introducing.  Better use @samp.

> +server with @command{emacsclient}.  If the daemon is not already
> +running, it will be started for you.
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
Please try rephrasing this to avoid passive tense.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49195; Package emacs. (Thu, 24 Jun 2021 15:51:02 GMT) Full text and rfc822 format available.

Message #17 received at 49195 <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 49195 <at> debbugs.gnu.org
Subject: Re: bug#49195: Starting Emacs if required from emacsclient.desktop
Date: Thu, 24 Jun 2021 16:50:07 +0100 (BST)
[Message part 1 (text/plain, inline)]
On Thu, 24 Jun 2021, Eli Zaretskii wrote:

>>> More generally, I'm not sure we should even say this in the Emacs
>>> manual, as these features belong to the desktop, not to Emacs.
>>
>> This section of the manual already describes how to start Emacs from systemd, which isn’t part of Emacs either.
>
> systemd support code is in emacs.c, so that is (borderline) okay.
> What you describe is just normal desktop invocation, AFAIU.

It’s not normal to provide two different desktop entries for launching an application in slightly different ways.  However, I don’t object if we think that this addition to the manual is superfluous and decide to drop it.

>> +may use the @dfn{Emacs (Client)} menu entry to connect to an Emacs
>
> It is wrong to use @dfn here, since this is not new terminology you
> are introducing.  Better use @samp.
>
>> +server with @command{emacsclient}.  If the daemon is not already
>> +running, it will be started for you.
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^
> Please try rephrasing this to avoid passive tense.

Done.

-- 
Peter Oliver
[0001-From-.desktop-files-reuse-a-frame-or-start-a-new-Ema.patch (text/plain, attachment)]

Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 24 Jun 2021 17:37:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49195; Package emacs. (Wed, 30 Jun 2021 13:13:02 GMT) Full text and rfc822 format available.

Message #22 received at 49195 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Peter Oliver <p.d.oliver <at> mavit.org.uk>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 49195 <at> debbugs.gnu.org
Subject: Re: bug#49195: Starting Emacs if required from emacsclient.desktop
Date: Wed, 30 Jun 2021 15:12:08 +0200
Peter Oliver <p.d.oliver <at> mavit.org.uk> writes:

>> Please try rephrasing this to avoid passive tense.
>
> Done.

Thanks; applied to Emacs 28.  (There was a merge conflict because of the
later patch I applied before this one, so if you could examine the
result and see whether I messed up, that'd be nice.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 49195 <at> debbugs.gnu.org and Peter Oliver <p.d.oliver <at> mavit.org.uk> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 30 Jun 2021 13:13:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Jul 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 271 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.