emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master cbf220b: From .desktop files, reuse a frame or start a new Emacs


From: Lars Ingebrigtsen
Subject: master cbf220b: From .desktop files, reuse a frame or start a new Emacs as required
Date: Wed, 30 Jun 2021 09:12:26 -0400 (EDT)

branch: master
commit cbf220bc31c0a00c45b22c140eda7854d81d991b
Author: Peter Oliver <git@mavit.org.uk>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    From .desktop files, reuse a frame or start a new Emacs as required
    
    * doc/emacs/misc.texi: (Using Emacs as a Server) Explain
    emacsclient.desktop.
    * etc/NEWS: (Emacs Server): Explain emacsclient.desktop.
    * emacs-mail.desktop, etc/emacsclient.desktop: Automatically try to
    reuse an existing frame, open a new frame, or start a new Emacs
    daemon.  Add actions for specific behaviours (bug#49195).
---
 doc/emacs/misc.texi     |  7 +++++++
 etc/NEWS                |  8 ++++++++
 etc/emacs-mail.desktop  | 16 +++++++++++++---
 etc/emacsclient.desktop | 11 ++++++++++-
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 027133c..3c11a39 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1757,6 +1757,13 @@ expression @code{(+ 1 2)} on the @samp{foo} server, and 
returns
 @code{3}.  (If there is no server with that name, an error is
 signaled.)  Currently, this feature is mainly useful for developers.
 
+  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 @samp{Emacs (Client)} menu entry to connect to an Emacs
+server with @command{emacsclient}.  The daemon starts if not
+already running.
+
 @menu
 * TCP Emacs server::     Listening to a TCP socket.
 * Invoking emacsclient:: Connecting to the Emacs server.
diff --git a/etc/NEWS b/etc/NEWS
index 6345992..701b9a7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -537,6 +537,14 @@ an edit instead of marking it as "Done" (which the 'C-x #' 
command
 does).  The 'emacsclient' program exits with an abnormal status as
 result of this command.
 
++++
+*** New desktop integration for connecting to the server.
+If your operating system’s desktop environment is
+freedesktop.org-compatible (which is true of most GNU/Linux and other
+recent Unix-like GUIs), you may use the new "Emacs (Client)" desktop
+menu entry to open files in an existing Emacs instance rather than
+starting a new one.  The daemon starts if not already running.
+
 ** Perl mode
 
 ---
diff --git a/etc/emacs-mail.desktop b/etc/emacs-mail.desktop
index 0c5fab1..251afa1 100644
--- a/etc/emacs-mail.desktop
+++ b/etc/emacs-mail.desktop
@@ -1,12 +1,22 @@
 [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")'
 Icon=emacs
 Name=Emacs (Mail)
 MimeType=x-scheme-handler/mailto;
 NoDisplay=false
 Terminal=false
 Type=Application
+
+Exec=emacs -f message-mailto %u
+# # If you prefer to use emacsclient, use this instead:
+# Exec=sh -c 'emacsclient --alternate-editor= --display="$DISPLAY" --eval 
"(message-mailto \"%u\")"'
+# 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/emacsclient.desktop b/etc/emacsclient.desktop
index f76fb2f..361051e 100644
--- a/etc/emacsclient.desktop
+++ b/etc/emacsclient.desktop
@@ -3,7 +3,7 @@ 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
+Exec=sh -c 'if [ -n "$*" ]; then exec emacsclient --alternate-editor= 
--display="$DISPLAY" "$@"; else exec emacsclient --alternate-editor= 
--create-frame; fi' placeholder %F
 Icon=emacs
 Type=Application
 Terminal=false
@@ -11,3 +11,12 @@ Categories=Development;TextEditor;
 StartupNotify=true
 StartupWMClass=Emacs
 Keywords=Text;Editor;
+Actions=new-window;new-instance;
+
+[Desktop Action new-instance]
+Name=New Window
+Exec=emacsclient --alternate-editor= --create-frame %F
+
+[Desktop Action new-instance]
+Name=New Instance
+Exec=emacs %F



reply via email to

[Prev in Thread] Current Thread [Next in Thread]