unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Dired - open files external
@ 2014-05-13  7:42 Martin
  2014-05-13 12:49 ` Eric Abrahamsen
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Martin @ 2014-05-13  7:42 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dired - open files external
  2014-05-13  7:42 Dired - open files external Martin
@ 2014-05-13 12:49 ` Eric Abrahamsen
  2014-05-13 13:13   ` Michael Heerdegen
  2014-05-13 12:58 ` Igor Sosa Mayor
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2014-05-13 12:49 UTC (permalink / raw)
  To: help-gnu-emacs

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.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dired - open files external
  2014-05-13  7:42 Dired - open files external Martin
  2014-05-13 12:49 ` Eric Abrahamsen
@ 2014-05-13 12:58 ` Igor Sosa Mayor
  2014-05-13 13:27 ` Igor Sosa Mayor
  2014-05-13 13:59 ` Drew Adams
  3 siblings, 0 replies; 8+ messages in thread
From: Igor Sosa Mayor @ 2014-05-13 12:58 UTC (permalink / raw)
  To: help-gnu-emacs

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
>
>

you could do this the following:

--8<---------------cut here---------------start------------->8---
(require 'dired+)

(setq dired-guess-shell-alist-user
        '(("\\.xls\\'" "soffice")
          ("\\.ods\\'" "soffice")
          ("\\.odt\\'" "soffice")
          ("\\.pdf\\'" "zathura")))
--8<---------------cut here---------------end--------------->8---

and then press ! on the file. 


-- 
:: Igor Sosa Mayor     :: joseleopoldo1792@gmail.com ::
:: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/      ::
:: jabberid: rogorido  ::                            ::




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dired - open files external
  2014-05-13 12:49 ` Eric Abrahamsen
@ 2014-05-13 13:13   ` Michael Heerdegen
  2014-05-14  3:42     ` Eric Abrahamsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2014-05-13 13:13 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Others will hopefully provide less extreme solutions!

Nowadays, there's at least the built-in `dired-do-async-shell-command',
bound to &.

Michael.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dired - open files external
  2014-05-13  7:42 Dired - open files external Martin
  2014-05-13 12:49 ` Eric Abrahamsen
  2014-05-13 12:58 ` Igor Sosa Mayor
@ 2014-05-13 13:27 ` Igor Sosa Mayor
  2014-05-13 13:59 ` Drew Adams
  3 siblings, 0 replies; 8+ messages in thread
From: Igor Sosa Mayor @ 2014-05-13 13:27 UTC (permalink / raw)
  To: help-gnu-emacs

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.)

you could do this the following:

--8<---------------cut here---------------start------------->8---
(require 'dired+)

(setq dired-guess-shell-alist-user
        '(("\\.xls\\'" "soffice")
          ("\\.ods\\'" "soffice")
          ("\\.odt\\'" "soffice")
          ("\\.pdf\\'" "zathura")))
--8<---------------cut here---------------end--------------->8---

and then press ! on the file. 


-- 
:: Igor Sosa Mayor     :: joseleopoldo1792@gmail.com ::
:: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/      ::
:: jabberid: rogorido  ::                            ::




^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Dired - open files external
  2014-05-13  7:42 Dired - open files external Martin
                   ` (2 preceding siblings ...)
  2014-05-13 13:27 ` Igor Sosa Mayor
@ 2014-05-13 13:59 ` Drew Adams
  3 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2014-05-13 13:59 UTC (permalink / raw)
  To: Martin, help-gnu-emacs

> 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.)

In addition to what others have mentioned, if you are on MS Windows
then, after loading `w32-browser.el' and `dired+.el', you can use
item `Open Associated Windows App' in the `Single' menu to open a
file with the associated program.

Same thing for the marked files, using `Open Associated Windows
Apps' in menus `Multiple' and `Multiple > Marked Here and Below'.

And you can use item `Single' > `Open in Windows Explorer' to open
a file or folder in Windows Explorer.

You can also right-click on a file and pick `Open Associated
Windows App' or `Open in Windows Explorer'.

There are key bindings for these as well:

`M-RET' or `mouse-2' - open with associated program
`C-RET' - open in Explorer



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dired - open files external
  2014-05-13 13:13   ` Michael Heerdegen
@ 2014-05-14  3:42     ` Eric Abrahamsen
  2014-05-14 11:38       ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2014-05-14  3:42 UTC (permalink / raw)
  To: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Others will hopefully provide less extreme solutions!
>
> Nowadays, there's at least the built-in
> `dired-do-async-shell-command', bound to &.

Yeah, and I use that when I have to, but I'd rather skip having to type
"xdg-open"!




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dired - open files external
  2014-05-14  3:42     ` Eric Abrahamsen
@ 2014-05-14 11:38       ` Michael Heerdegen
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2014-05-14 11:38 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> > Nowadays, there's at least the built-in
> > `dired-do-async-shell-command', bound to &.
>
> Yeah, and I use that when I have to, but I'd rather skip having to type
> "xdg-open"!

You can use M-n in the minibuffer to cycle between the programs you have
specified in `dired-guess-shell-alist-user' for the according file(s).

Michael.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-05-14 11:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-13  7:42 Dired - open files external Martin
2014-05-13 12:49 ` Eric Abrahamsen
2014-05-13 13:13   ` Michael Heerdegen
2014-05-14  3:42     ` Eric Abrahamsen
2014-05-14 11:38       ` Michael Heerdegen
2014-05-13 12:58 ` Igor Sosa Mayor
2014-05-13 13:27 ` Igor Sosa Mayor
2014-05-13 13:59 ` Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).