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

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

Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs


From: Bill Clementson
Subject: Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs
Date: Tue, 28 Aug 2007 13:45:58 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin)

Hi Tassilo,

I made some mods to my copy of the doc-view function so that it can
either be passed a file name or called from dired:

diff --git a/doc-view.el b/doc-view.el
index 5742019..bcfcbb1 100644
--- a/doc-view.el
+++ b/doc-view.el
@@ -382,7 +382,7 @@ For now these keys are useful:
     (message "DocView: finished conversion!")
     (doc-view-display doc-view-current-doc)))
 
-(defun doc-view (no-cache)
+(defun doc-view (no-cache &optional file)
   "Query for a document, convert it to png and start viewing it.
 If this file is still in the cache, don't convert and use the
 existing page files.  With prefix arg NO-CACHE, don't use the
@@ -391,7 +391,8 @@ cached files and convert anew."
   (if (not (and (image-type-available-p 'png)
                 (display-images-p)))
       (message "DocView: your emacs or display doesn't support png images.")
-    (let* ((doc (expand-file-name (read-file-name "File: " nil nil t)))
+    (let* ((doc (or file
+                   (expand-file-name (read-file-name "File: " nil nil t))))
           (buffer (get-buffer-create (format "*DocView: %s*" doc)))
           (dir (doc-view-file-name-to-directory-name doc)))
       (switch-to-buffer buffer)

I've also added a "V" key in my .emacs file so that dired can call
doc-view:

(defun doc-view-dired (no-cache)
  "View the current dired file with doc-view."
  (interactive "P")
  (doc-view no-cache (dired-get-file-for-visit)))

(define-key dired-mode-map "V" 'doc-view-dired)

I find this very convenient and you might want to consider adding
something similar.

- Bill





reply via email to

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