diff options
-rw-r--r-- | exwm.org | 2 | ||||
-rw-r--r-- | init.org | 6 | ||||
-rw-r--r-- | lib/doc/jao-doc-view.el | 11 | ||||
-rw-r--r-- | lib/eos/jao-afio.el | 25 |
4 files changed, 24 insertions, 20 deletions
@@ -331,6 +331,8 @@ (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--enable-imenu (car info) #'jao-zathura-goto-page)))) @@ -2212,15 +2212,13 @@ (jao-afio--goto-docs) (if b (pop-to-buffer b) (find-file file)))) - (defun jao-open-doc (file) - (message "Opening %s" file) - (funcall jao-open-doc-fun file)) + (defun jao-open-doc (file) (funcall jao-open-doc-fun file)) (defun jao-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-find-or-open doc)))) + (jao-open-doc doc)))) (defun jao-afio-open-pdf (file page &optional height) (jao-open-doc file) 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) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index d031e59..90abc7f 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -131,18 +131,19 @@ (defvar jao-afio-switch-hook nil) (defun jao-afio--goto-frame (next &optional reset) - (let ((next-cfg (when (not reset) (get-register next)))) - (window-configuration-to-register jao-afio--current-config) - (setq jao-afio--current-config next) - (if next-cfg - (jump-to-register next) - (delete-other-windows) - (cl-case next - (?w (jao-afio-open-www)) - (?g (jao-afio-open-gnus)) - (?p (jao-afio-open-doc)) - (?s (delete-other-windows)))) - (run-hooks 'jao-afio-switch-hook))) + (when (or reset (not (eq next jao-afio--current-config))) + (let ((next-cfg (when (not reset) (get-register next)))) + (window-configuration-to-register jao-afio--current-config) + (setq jao-afio--current-config next) + (if next-cfg + (jump-to-register next) + (delete-other-windows) + (cl-case next + (?w (jao-afio-open-www)) + (?g (jao-afio-open-gnus)) + (?p (jao-afio-open-doc)) + (?s (delete-other-windows)))) + (run-hooks 'jao-afio-switch-hook)))) (defun jao-afio--goto-main (&optional reset) (interactive "P") |