From 622face2db67129761aa128450c132aa48386a84 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Wed, 9 Jan 2008 10:25:17 +0000 Subject: [PATCH] 2008-01-09 Tassilo Horn * doc-view.el (doc-view-mode-p): Add EPS as supported type. (doc-view-mode): Support document files inside archives. --- lisp/ChangeLog | 5 +++++ lisp/doc-view.el | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e72275e9010..b6f0a0f57bf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-01-09 Tassilo Horn + + * doc-view.el (doc-view-mode-p): Add EPS as supported type. + (doc-view-mode): Support document files inside archives. + 2008-01-09 Dan Nicolaescu * vc.el (vc-deduce-fileset): Return the currently selected file if diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 9c153dc584f..83f9be53ae3 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -476,7 +476,7 @@ Image types are symbols like `dvi', `postscript' or `pdf'." (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 @@ You can use \\\\[doc-view-toggle-display] to 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 @@ toggle between displaying the document or editing it as text." (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) -- 2.39.2