From 84508dbc948038f9b7c797b3ec012c00379df7ee Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Tue, 25 May 2021 22:06:43 +0100 Subject: [PATCH] From a GUI, lauch via emacsclient by default * etc/emacs-mail.desktop, etc/emacs.desktop: Call emacsclient not emacs by default. Provide plain emacs as an alternative action. --- etc/NEWS | 7 +++++++ etc/emacs-mail.desktop | 13 ++++++++++--- etc/emacs.desktop | 11 ++++++++++- etc/emacsclient.desktop | 12 ------------ 4 files changed, 27 insertions(+), 16 deletions(-) delete mode 100644 etc/emacsclient.desktop diff --git a/etc/NEWS b/etc/NEWS index 1541b74a3b..0605c8b46c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -108,6 +108,13 @@ avoid security issues when executing untrusted code. See the manual page for 'seccomp' system call, for details about Secure Computing filters. +** Launching Emacs from a GUI now defaults to trying emacsclient. +When launching Emacs via a freedesktop.org-compatible GUI, it is now +the default to try to use emacsclient to open the file in an existing +Emacs frame. Opening a new frame in an existing Emacs or a separate +instance of Emacs are available as an alternative action (performed, +for example, by right-clicking on the icon). + * Changes in Emacs 28.1 diff --git a/etc/emacs-mail.desktop b/etc/emacs-mail.desktop index 0c5fab1dd1..e949b7f1ed 100644 --- a/etc/emacs-mail.desktop +++ b/etc/emacs-mail.desktop @@ -1,12 +1,19 @@ [Desktop Entry] Categories=Network;Email; Comment=GNU Emacs is an extensible, customizable text editor - and more -Exec=emacs -f message-mailto %u -# If you prefer to use emacsclient, use this instead -#Exec=emacsclient -e '(message-mailto "%u")' +Exec=emacsclient --alternate-editor= --eval '(message-mailto "%u")' Icon=emacs Name=Emacs (Mail) MimeType=x-scheme-handler/mailto; NoDisplay=false Terminal=false Type=Application +Actions=new-window;new-instance; + +[Desktop Action new-window] +Name=New Window +Exec=emacsclient --alternate-editor= --create-frame --eval '(message-mailto "%u")' + +[Desktop Action new-instance] +Name=New Instance +Exec=emacs -f message-mailto %u diff --git a/etc/emacs.desktop b/etc/emacs.desktop index 2e6496e58c..d21bba0e10 100644 --- a/etc/emacs.desktop +++ b/etc/emacs.desktop @@ -3,10 +3,19 @@ Name=Emacs GenericName=Text Editor Comment=Edit text MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; -Exec=emacs %F +Exec=emacsclient --alternate-editor= %F Icon=emacs Type=Application Terminal=false Categories=Development;TextEditor; StartupWMClass=Emacs Keywords=Text;Editor; +Actions=new-window;new-instance; + +[Desktop Action new-window] +Name=New Window +Exec=emacsclient --alternate-editor= --create-frame %F + +[Desktop Action new-instance] +Name=New Instance +Exec=emacs %F diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop deleted file mode 100644 index 3feb83c729..0000000000 --- a/etc/emacsclient.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Name=Emacs (Client) -GenericName=Text Editor -Comment=Edit text -MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; -Exec=emacsclient -c %F -Icon=emacs -Type=Application -Terminal=false -Categories=Development;TextEditor; -StartupWMClass=Emacsd -Keywords=Text;Editor; -- 2.31.1