Function: doc-view-mode-p

doc-view-mode-p is an autoloaded and byte-compiled function defined in doc-view.el.gz.

Signature

(doc-view-mode-p TYPE)

Documentation

Return non-nil if document type TYPE is available for doc-view.

Document types are symbols like dvi, ps, pdf, epub, cbz, fb2, xps, oxps, orodf (any OpenDocument format).

Source Code

;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
;;;###autoload
(defun doc-view-mode-p (type)
  "Return non-nil if document type TYPE is available for `doc-view'.
Document types are symbols like `dvi', `ps', `pdf', `epub',
`cbz', `fb2', `xps', `oxps', or`odf' (any OpenDocument format)."
  (and (display-graphic-p)
       (image-type-available-p 'png)
       (cond
	((eq type 'dvi)
	 (and (doc-view-mode-p 'pdf)
	      (or (and doc-view-dvipdf-program
		       (executable-find doc-view-dvipdf-program))
		  (and doc-view-dvipdfm-program
		       (executable-find doc-view-dvipdfm-program)))))
	((memq type '(postscript ps eps pdf))
         (or (and doc-view-ghostscript-program
                  (executable-find doc-view-ghostscript-program))
             ;; for pdf also check for `doc-view-pdfdraw-program'
             (when (eq type 'pdf)
               (and doc-view-pdfdraw-program
                    (executable-find doc-view-pdfdraw-program)))))
	((eq type 'odf)
         (and (executable-find doc-view-odf->pdf-converter-program)
	      (doc-view-mode-p 'pdf)))
	((eq type 'djvu)
	 (executable-find "ddjvu"))
        ((memq type '(epub cbz fb2 xps oxps))
         ;; first check if `doc-view-pdfdraw-program' is set to mutool
         (and (string= doc-view-pdfdraw-program "mutool")
              (executable-find "mutool")))
	(t ;; unknown image type
	 nil))))