changeset 86441:6934c0956614

(doc-view-mode-p): New function.
author Reiner Steib <Reiner.Steib@gmx.de>
date Sun, 25 Nov 2007 20:11:47 +0000
parents 4aedd218aad1
children 3082569ef3c5
files lisp/ChangeLog lisp/doc-view.el
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Nov 25 16:48:31 2007 +0000
+++ b/lisp/ChangeLog	Sun Nov 25 20:11:47 2007 +0000
@@ -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):
--- a/lisp/doc-view.el	Sun Nov 25 16:48:31 2007 +0000
+++ b/lisp/doc-view.el	Sun Nov 25 20:11:47 2007 +0000
@@ -456,6 +456,24 @@
       (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)