all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Haselwarter <philipp.haselwarter@gmx.de>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: help-gnu-emacs@gnu.org
Subject: Re: emacs and xdg-open
Date: Mon, 09 Jan 2012 23:26:04 +0100	[thread overview]
Message-ID: <87vcokms1v.fsf@nzebook.haselwarter.org> (raw)
In-Reply-To: <8739bp5gkn.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Mon, 09 Jan 2012 18:13:44 +0800")

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> I'm running archlinux, stumpwm and emacs, and have had pretty resounding
> success using dired as my only file manager: in dired I've bound 'e' to
> a command that passes files to xdg-open, and by dint of copying
> /usr/share/applications/mimeinfo.cache into
> ~/.local/share/applications/default.list, the right external
> applications open files out of dired.

Thanks for sharing, fits my setup quite well!

What command you use to call `xdg-open'?

Some programs (eg. mplayer) exit uncleanly when their stderr and stdout
are closed, which causes xdg-open to reopen the file with the default
application for unknown mime types, as it appears.
And allocating a buffer to every started program....

> The one iffy thing is getting other applications to pass directory
> references to emacs (ie clicking the dropbox applet icon in the system
> tray and having the dropbox directory open in dired). Pointing
> the inode/directory MIME type at emacs works, but starts a new emacs
> instance. I created a "emacsclient.desktop" file:
>
> [Desktop Entry]
> Name=EmacsClient
> MimeType=inode/directory;x-directory/normal
> Exec=emacsclient -n %F
> Type=Application
> Terminal=false
>
> And this nearly works, except that the '-n' flag to the emacsclient exec
> doesn't appear to be respected: emacs still tells me "Press C-x # when
> you're done editing this file" (this being a dired buffer), and if I
> kill the buffer it asks: "Buffer `Dropbox' still has clients; kill it?"
>
> I guess this is a long shot, but does anyone have a guess as to why the
> '-n' flag is ignored, and how to fix it? If not, please consider this a
> (nearly-functional) tutorial on using emacs as your only file manager on
> linux systems without a proper desktop environment. :)
>
> Yrs,
> Eric

I wrote a quick test script, and it looks like it's not Emacs' fault,
arguments are just not passed on.

Actually, it the Exec line seems not to be honored; instead simply the
basename of the .desktop gets executed (ie. just emacsclient).

So in order to make everything work, you need to create a script with a
new name (and also beware of applications that don't call emacsclient
with an argument, it'll fail):

emacsclient_wrapper
#!/bin/sh
[ "$@" ] && emacsclient -n $@ || emacsclient -n ~/

Leave out the -n in the desktop file and rename it accordingly:

emacsclient_wrapper.desktop

-- 
Philipp Haselwarter



  reply	other threads:[~2012-01-09 22:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 10:13 emacs and xdg-open Eric Abrahamsen
2012-01-09 22:26 ` Philipp Haselwarter [this message]
2012-01-10  3:07   ` Eric Abrahamsen
2012-01-10 19:29     ` Philipp Haselwarter
2012-01-11  5:00       ` Eric Abrahamsen

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=87vcokms1v.fsf@nzebook.haselwarter.org \
    --to=philipp.haselwarter@gmx.de \
    --cc=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /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.