summaryrefslogtreecommitdiffhomepage
path: root/lib/doc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/doc')
-rw-r--r--lib/doc/jao-doc-view.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/doc/jao-doc-view.el b/lib/doc/jao-doc-view.el
index f917b96..f7984f0 100644
--- a/lib/doc/jao-doc-view.el
+++ b/lib/doc/jao-doc-view.el
@@ -30,6 +30,11 @@
(require 'doc-view)
(defvar jao-doc-view-session-file "~/.emacs.d/cache/doc-view-session.eld")
+(defvar-local jao-doc-view--is-pdf nil)
+
+(defun jao-doc-view-session-mark () (setq-local jao-doc-view--is-pdf t))
+(defun jao-doc-view--is-pdf ()
+ (or jao-doc-view--is-pdf (derived-mode-p 'doc-view-mode 'pdf-view-mode)))
(defun jao-doc-view--read-file (file)
(let ((buff (find-file-noselect file)))
@@ -54,16 +59,14 @@
(cb (when skip-current (current-buffer))))
(dolist (b (buffer-list))
(with-current-buffer b
- (when (and (derived-mode-p 'doc-view-mode 'pdf-view-mode)
- (not (equalp cb b)))
+ (when (and (jao-doc-view--is-pdf) (not (equalp cb b)))
(add-to-list 'docs (buffer-file-name)))))
(when (> (length docs) 0)
(jao-doc-view--save-to-file jao-doc-view-session-file docs))
(message "%s docs saved" (length docs))))
(defun jao-doc-view--save-session-1 ()
- (when (derived-mode-p 'pdf-view-mode 'doc-view-mode)
- (jao-doc-view-save-session t)))
+ (when (jao-doc-view--is-pdf) (jao-doc-view-save-session t)))
(defun jao-doc-view--save-session ()
(let ((inhibit-message t)