[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new dired viewer
From: |
John Russell |
Subject: |
Re: new dired viewer |
Date: |
03 Apr 2003 09:44:52 -0500 |
> This isn't so much a bug report as a suggestion. I just downloaded
> emacs from cvs yesterday. I really like the dired viewer that allows
> the spawning of external viewers for certain file types. However,
> emacs seems to have to wait for the process to die. Is there any way
> to start a viewer and then cut it loose? It would be nice to view a
> pdf in xpdf and still be able to use emacs afterward. Thanks.
> ! xpdf * &
>
> is probably the most convenient available way. I do not know whether
> this is convenient enough for your purposes.
Actually, rms sent me this fix which is exactly what I was hoping for.
How about this replacement function?
(defun dired-view-file ()
"In Dired, examine a file in view mode, returning to dired when done.
When file is a directory, show it in this buffer if it is inserted.
Some kinds of files are displayed using external viewer programs;
see `dired-view-command-alist'. Otherwise, display it in another
buffer."
(interactive)
(let ((file (dired-get-file-for-visit)))
(if (file-directory-p file)
(or (and (cdr dired-subdir-alist)
(dired-goto-subdir file))
(dired file))
(let (cmd)
;; Look for some other way to view a certain file.
(dolist (elt dired-view-command-alist)
(if (string-match (car elt) file)
(setq cmd (cdr elt))))
(if cmd
(call-process shell-file-name nil 0 nil
"-c"
(concat cmd " "
(shell-quote-argument file)
" &"))
(view-file file))))))