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

X-FreeDesktop integration



This is a cross-post, parallel to one on emacs-devel@gnu.org. I'm making
the cross-post because it addresses a type of customization that debian
might want to make independently to its Emacs.

Emacs is available as a GUI package, but is not integrated by default
into any standard liux desktop that I'm aware of. For example, if you
open a file manager, select one or more files, and opt to open them in
Emacs, an instance of Emacs *will* launch, but will not present the
selected files. In the context of trying to make Emacs less painful for
new users to adopt, this would be one more incremental step.

Making this happen is easy, and below is a simple two-step proposal to
accomplish it. Note that in step one I've intentionally omitted the
Mimetypes to associate because depending on how you feel about Emacs,
that could be just about anything.

** Step 1: New file: /usr/share/applications/emacs-client.desktop
  + needs line "MimeType="
#+begin_src conf
[Desktop Entry]
Name=Emacsclient
GenericName=Connect to an Emacs server
X-GNOME-FullName=Connect to an Emacs server
Encoding=UTF-8
Version=1.0
Comment=Connect to an Emacs server using emacsclient
NoDisplay=false
Exec=\emacsclient -c --alternate-editor="" --eval "(pick-a-suitable-name \"%F\")"
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=emacs
Categories=Office;Development
StartupWMClass=Emacs
StartupNotify=true
# Mimetypes=
 #+END_SRC


** Step 2: New function: pick-a-suitable-name
 #+BEGIN_SRC emacs-lisp
  (defun pick-a-suitable-name (&optional files)
    "Integrate GUI Emacs with XFreeDesktop"
    ;; Do optional 'stuff'
    ;; Do other optional 'stuff'
    (dolist (file (split-string (substring files 1 -1) "' '"))
      (find-file file))
    ;; Do more optional 'stuff'
    )
 #+END_SRC

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0


Reply to: