# HG changeset patch # User Reiner Steib # Date 1196021507 0 # Node ID 6934c095661423615b9e32a8f158ac4193359849 # Parent 4aedd218aad1ff2553ccf3312210491b30bdd94f (doc-view-mode-p): New function. diff -r 4aedd218aad1 -r 6934c0956614 lisp/ChangeLog --- 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 + + * doc-view.el (doc-view-mode-p): New function. + 2007-11-25 Dan Nicolaescu * mail/mspools.el (rmail-get-new-mail): diff -r 4aedd218aad1 -r 6934c0956614 lisp/doc-view.el --- 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)