unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Dired changes
       [not found] <rzqu10mxiuk.fsf@albion.dl.ac.uk>
@ 2004-03-31 20:59 ` Juri Linkov
  2004-04-01 22:08   ` Dave Love
  2004-04-02  5:59   ` Richard Stallman
  0 siblings, 2 replies; 3+ messages in thread
From: Juri Linkov @ 2004-03-31 20:59 UTC (permalink / raw)
  Cc: emacs-devel

Dave Love <d.love@dl.ac.uk> writes in dired.el:
> +;; Fixme: This should use mailcap.
>  (defcustom dired-view-command-alist
>    '(("[.]\\(ps\\|ps_pages\\|eps\\)\\'" . "gv -spartan -color -watch %s")
>      ("[.]pdf\\'" . "xpdf %s")

I had this feature for a long time in .emacs, and it's really a useful thing.
It could be added to dired.el, but I'm not sure where to add it.
One possibility is to add directly to the `dired-view-file' like:

diff -u -r1.280 dired.el
--- emacs/lisp/dired.el	31 Mar 2004 16:29:46 -0000	1.280
+++ emacs/lisp/dired.el	31 Mar 2004 19:34:25 -0000
@@ -1489,11 +1489,22 @@
 	(dolist (elt dired-view-command-alist)
 	  (if (string-match (car elt) file)
 	      (setq cmd (cdr elt))))
+        (unless cmd
+          (require 'mailcap)
+          (require 'mm-decode)
+          (mailcap-parse-mailcaps)
+          (let* ((ext (file-name-extension file))
+                 (mime (and ext (mailcap-extension-to-mime ext)))
+                 (info (and mime (mailcap-mime-info mime))))
+            (if (stringp info)
+                (setq cmd (mm-mailcap-command info file (list mime))))))
 	(if cmd
 	    (call-process shell-file-name nil 0 nil
 			  "-c"

But it may be undesirable to call external programs for some system-wide
defined extensions.

Perhaps it's better to make a separate command `dired-view-file-externally'
and to bind it, for example, to V.

Or to add this code to the `dired-guess-shell-command' from dired-x.el.

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

* Re: Dired changes
  2004-03-31 20:59 ` Dired changes Juri Linkov
@ 2004-04-01 22:08   ` Dave Love
  2004-04-02  5:59   ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Love @ 2004-04-01 22:08 UTC (permalink / raw)
  Cc: emacs-devel

Juri Linkov <juri@jurta.org> writes:

> Dave Love <d.love@dl.ac.uk> writes in dired.el:
>> +;; Fixme: This should use mailcap.
>>  (defcustom dired-view-command-alist
>>    '(("[.]\\(ps\\|ps_pages\\|eps\\)\\'" . "gv -spartan -color -watch %s")
>>      ("[.]pdf\\'" . "xpdf %s")
>
> I had this feature for a long time in .emacs, and it's really a useful thing.
> It could be added to dired.el, but I'm not sure where to add it.

Unfortunately, rms doesn't allow use of Gnus stuff like mailcap by
other packages.  (I wrote the comment long ago, and I guess it
shouldn't have been in the patch.)

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

* Re: Dired changes
  2004-03-31 20:59 ` Dired changes Juri Linkov
  2004-04-01 22:08   ` Dave Love
@ 2004-04-02  5:59   ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2004-04-02  5:59 UTC (permalink / raw)
  Cc: d.love, emacs-devel

    I had this feature for a long time in .emacs, and it's really a useful thing.
    It could be added to dired.el, but I'm not sure where to add it.
    One possibility is to add directly to the `dired-view-file' like:

Could you explain to me what this change does?
What is "mailcap" anyway?

    +          (require 'mailcap)
    +          (require 'mm-decode)

These appear to be in Gnus.  If we are going to use them in Dired we
will have to move them out of Gnus.

A command like this ought to ask the user for confirmation before
actually running a shell command found in that list.

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

end of thread, other threads:[~2004-04-02  5:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <rzqu10mxiuk.fsf@albion.dl.ac.uk>
2004-03-31 20:59 ` Dired changes Juri Linkov
2004-04-01 22:08   ` Dave Love
2004-04-02  5:59   ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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