changeset 87681:92ee34bb9001

2008-01-09 Tassilo Horn <tassilo@member.fsf.org> * doc-view.el (doc-view-mode-p): Add EPS as supported type. (doc-view-mode): Support document files inside archives.
author Tassilo Horn <tassilo@member.fsf.org>
date Wed, 09 Jan 2008 10:24:52 +0000
parents 30126318d2b0
children 2698fd71ec80
files lisp/doc-view.el
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/doc-view.el	Wed Jan 09 07:40:37 2008 +0000
+++ b/lisp/doc-view.el	Wed Jan 09 10:24:52 2008 +0000
@@ -476,7 +476,7 @@
 	 (and (doc-view-mode-p 'pdf)
 	      doc-view-dvipdfm-program
 	      (executable-find doc-view-dvipdfm-program)))
-	((or (eq type 'postscript) (eq type 'ps)
+	((or (eq type 'postscript) (eq type 'ps) (eq type 'eps)
 	     (eq type 'pdf))
 	 (and doc-view-ghostscript-program
 	      (executable-find doc-view-ghostscript-program)))
@@ -930,6 +930,7 @@
 toggle between displaying the document or editing it as text."
   (interactive)
   (if jka-compr-really-do-compress
+
       ;; This is a compressed file uncompressed by auto-compression-mode.
       (when (y-or-n-p (concat "DocView: Cannot convert compressed file.  "
 			      "Save it uncompressed first? "))
@@ -940,11 +941,21 @@
 	  (kill-buffer nil)
 	  (find-file file)
 	  (doc-view-mode)))
+
+    ;; When opening a pdf/ps/dvi that's inside an archive (tar, zip, ...) the
+    ;; file buffer-file-name doesn't exist, so create the directory and save
+    ;; the file.
+    (when (not (file-exists-p (file-name-directory buffer-file-name)))
+      (dired-create-directory (file-name-directory buffer-file-name)))
+    (when (not (file-exists-p buffer-file-name))
+      (write-file buffer-file-name))
+
     (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode)
 				doc-view-previous-major-mode
 			      major-mode)))
       (kill-all-local-variables)
       (set (make-local-variable 'doc-view-previous-major-mode) prev-major-mode))
+
     (make-local-variable 'doc-view-current-files)
     (make-local-variable 'doc-view-current-image)
     (make-local-variable 'doc-view-current-page)