help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Dired - open files external


From: Eric Abrahamsen
Subject: Re: Dired - open files external
Date: Tue, 13 May 2014 20:49:41 +0800
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux)

Martin <kleinerdrache@gmx.at> writes:

> Hi there,
>
> Dired works fine here, but I cannot figure out how to open the filex
> external.
>
> Special docx and pdf should be opened external, pdf not allways but
> mostly.  How can I do that?  (For docx - it does not make much sense for
> me to see the files inside, but open it with libreoffice would be quite
> good.)
>
> Thanks,
> Martin

I've found external-file programs to be one of the more gruesome
aspects of Emacs, with solutions ranging from mailcap to xdg-open.
Multiple packages demand their individual solutions. I have opted for
the scorched-earth policy, and tried to route absolutely everything
non-emacs through xdg-open. Then, at the very least, I have one point of
control. For dired, that looks like this:

(defun dired-open (&optional file-list)
  (interactive
   (list (dired-get-marked-files t current-prefix-arg)))
  (apply 'call-process "xdg-open" nil 0 nil file-list))

;;'e' usually does 'dired-find-file, same as RET, rebinding it here
(add-hook 'dired-mode-hook
          '(lambda ()
            (define-key dired-mode-map (kbd "e") 'dired-open)))

(setq image-dired-external-viewer "/usr/bin/xdg-open")

Others will hopefully provide less extreme solutions!

Eric

This reminds me that one of my tasks for the next couple of days is
making org-open-file also a slave to xdg-open.




reply via email to

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