From 45bf5ca9f1ab4fcec6388ba9624e6eac719e0b24 Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 17 Apr 2021 02:41:57 +0100 Subject: nits --- lib/doc/jao-doc-view.el | 3 +-- lib/eos/jao-afio.el | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/doc/jao-doc-view.el b/lib/doc/jao-doc-view.el index 0687518..058fc04 100644 --- a/lib/doc/jao-doc-view.el +++ b/lib/doc/jao-doc-view.el @@ -64,8 +64,7 @@ (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)))) (defun jao-doc-view--save-session-1 () (when (jao-doc-view--is-pdf) (jao-doc-view-save-session t))) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 90abc7f..7ebaf5d 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -64,22 +64,27 @@ (jao-afio--goto-frame next))) ;;;###autoload +(defvar jao-open-doc-fun 'find-file) + +;;;###autoload +(defun jao-afio-open-pdf-session () + (interactive) + (dolist (doc (jao-doc-view-session)) + (when (and (file-exists-p doc) (y-or-n-p (format "Open %s? " doc))) + (jao-open-doc doc)))) + (defun jao-afio-open-doc () (interactive) (delete-other-windows) (split-window-right) (let ((docs (remove-if-not (lambda (b) - (eq (buffer-local-value 'major-mode b) - 'pdf-view-mode)) + (with-current-buffer b (jao-doc-view--is-pdf))) (buffer-list)))) (if (car docs) (progn (switch-to-buffer (car docs)) (switch-to-buffer-other-window (or (cadr docs) (car docs)))) - (when (and (jao-doc-view-session) - (y-or-n-p "Load saved session? ")) - (dolist (doc (jao-doc-view-session)) - (when (and (file-exists-p doc) (y-or-n-p (format "Open %s? " doc))) - (find-file doc))))))) + (when (and (jao-doc-view-session) (y-or-n-p "Load saved session? ")) + (jao-afio-open-pdf-session))))) (defvar jao-afio-use-w3m nil) (declare w3m "w3m") -- cgit v1.2.3