[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: doc-view and mailcap
From: |
Tassilo Horn |
Subject: |
Re: doc-view and mailcap |
Date: |
Mon, 26 Nov 2007 12:16:27 +0100 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux) |
Reiner Steib <address@hidden> writes:
Hi Reiner,
> Committed:
>
> (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))))
Yes, that looks fine. Here's a patch that lets
`doc-view-initiate-display' use the new function.
--8<---------------cut here---------------start------------->8---
2007-11-26 Tassilo Horn <address@hidden>
* doc-view.el (doc-view-initiate-display): Use `doc-view-mode-p'.
--8<---------------cut here---------------end--------------->8---
--8<---------------cut here---------------start------------->8---
Index: lisp/doc-view.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/doc-view.el,v
retrieving revision 1.24
diff -u -r1.24 doc-view.el
--- lisp/doc-view.el 25 Nov 2007 20:11:47 -0000 1.24
+++ lisp/doc-view.el 26 Nov 2007 11:14:53 -0000
@@ -234,8 +234,12 @@
(defvar doc-view-current-image nil
"Only used internally.")
-(defvar doc-view-current-overlay)
-(defvar doc-view-pending-cache-flush nil)
+
+(defvar doc-view-current-overlay nil
+ "Only used internally.")
+
+(defvar doc-view-pending-cache-flush nil
+ "Only used internally.")
(defvar doc-view-current-info nil
"Only used internally.")
@@ -887,8 +891,7 @@
(defun doc-view-initiate-display ()
;; Switch to image display if possible
- (if (and (display-images-p)
- (image-type-available-p 'png))
+ (if (doc-view-mode-p (intern (file-name-extension buffer-file-name)))
(progn
(doc-view-buffer-message)
(setq doc-view-current-page (or doc-view-current-page 1))
@@ -905,8 +908,9 @@
(message
"%s"
(substitute-command-keys
- (concat "No image (png) support available. Type
\\[doc-view-toggle-display] "
- "to switch to an editing mode.")))))
+ (concat "No image (png) support available or some conversion utility for
"
+ (file-name-extension buffer-file-name)" files is missing. "
+ "Type \\[doc-view-toggle-display] to switch to an editing
mode.")))))
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo