summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--exwm.org4
-rw-r--r--lib/doc/jao-doc-view.el14
2 files changed, 10 insertions, 8 deletions
diff --git a/exwm.org b/exwm.org
index aee12a5..96e3ecf 100644
--- a/exwm.org
+++ b/exwm.org
@@ -331,9 +331,9 @@
(defun jao-exwm--zathura-setup ()
(when (and (string= exwm-class-name "Zathura")
(not jao-doc-view--imenu-file))
- (jao-doc-view-session-mark)
- (jao-doc-view-save-session)
(let ((info (jao-zathura--file-info (current-buffer))))
+ (jao-doc-view-session-mark (car info))
+ (jao-doc-view-save-session)
(jao-doc-view--enable-imenu (car info) #'jao-zathura-goto-page))))
(add-hook 'exwm-update-title-hook #'jao-exwm--zathura-setup t)
diff --git a/lib/doc/jao-doc-view.el b/lib/doc/jao-doc-view.el
index f7984f0..0687518 100644
--- a/lib/doc/jao-doc-view.el
+++ b/lib/doc/jao-doc-view.el
@@ -32,9 +32,11 @@
(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-session-mark (path) (setq-local jao-doc-view--is-pdf path))
(defun jao-doc-view--is-pdf ()
- (or jao-doc-view--is-pdf (derived-mode-p 'doc-view-mode 'pdf-view-mode)))
+ (or jao-doc-view--is-pdf
+ (when (derived-mode-p 'doc-view-mode 'pdf-view-mode)
+ (buffer-file-name))))
(defun jao-doc-view--read-file (file)
(let ((buff (find-file-noselect file)))
@@ -59,11 +61,11 @@
(cb (when skip-current (current-buffer))))
(dolist (b (buffer-list))
(with-current-buffer b
- (when (and (jao-doc-view--is-pdf) (not (equalp cb b)))
- (add-to-list 'docs (buffer-file-name)))))
+ (when-let (fn (and (not (equalp cb b)) (jao-doc-view--is-pdf)))
+ (add-to-list 'docs fn))))
(when (> (length docs) 0)
- (jao-doc-view--save-to-file jao-doc-view-session-file docs))
- (message "%s docs saved" (length docs))))
+ (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 (jao-doc-view--is-pdf) (jao-doc-view-save-session t)))