]> git.eshelyaron.com Git - emacs.git/commitdiff
(doc-view-mode-p): New function.
authorReiner Steib <Reiner.Steib@gmx.de>
Sun, 25 Nov 2007 20:11:47 +0000 (20:11 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Sun, 25 Nov 2007 20:11:47 +0000 (20:11 +0000)
lisp/ChangeLog
lisp/doc-view.el

index db63633382612e8e157c66fbd7053faf8aacc7b9..8cdee883b828b87a4348c3a5cd57327dae296389 100644 (file)
@@ -1,3 +1,7 @@
+2007-11-25  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * doc-view.el (doc-view-mode-p): New function.
+
 2007-11-25  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * mail/mspools.el (rmail-get-new-mail):
index 5443bc3672ed6bbb9866843aee7fcfe2a8703b3f..d0515fffe70bcf9caac1012b02b6c345ca595de9 100644 (file)
@@ -456,6 +456,24 @@ It's a subdirectory of `doc-view-cache-directory'."
       (when (not (funcall predicate item))
        (setq new-list (cons item new-list))))))
 
+;;;###autoload
+(defun doc-view-mode-p (type)
+  "Return non-nil if image type TYPE is available for `doc-view'.
+Image types are symbols like `dvi', `postscript' or `pdf'."
+  (and (display-graphic-p)
+       (image-type-available-p 'png)
+       (cond
+       ((eq type 'dvi)
+        (and (doc-view-mode-p 'pdf)
+             doc-view-dvipdfm-program
+             (executable-find doc-view-dvipdfm-program)))
+       ((or (eq type 'postscript) (eq type 'ps)
+            (eq type 'pdf))
+        (and doc-view-ghostscript-program
+             (executable-find doc-view-ghostscript-program)))
+       (t ;; unknown image type
+        nil))))
+
 ;;;; Conversion Functions
 
 (defvar doc-view-shrink-factor 1.125)