diff options
author | jao <jao@gnu.org> | 2022-04-18 00:01:24 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-04-18 00:01:24 +0100 |
commit | 286934e3ed238a2ee8c6137568742e917bc44d97 (patch) | |
tree | cbaa2e8103f097e098f380ad5cdc2ad09e296789 /lib | |
parent | bc73fd3f9e2f10ae22cd72d478ceea0143c37b32 (diff) | |
download | elibs-286934e3ed238a2ee8c6137568742e917bc44d97.tar.gz elibs-286934e3ed238a2ee8c6137568742e917bc44d97.tar.bz2 |
epub files in doc session
Diffstat (limited to 'lib')
-rw-r--r-- | lib/doc/jao-doc-view.el | 17 | ||||
-rw-r--r-- | lib/eos/jao-afio.el | 2 |
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/doc/jao-doc-view.el b/lib/doc/jao-doc-view.el index 4e210f3..ea55565 100644 --- a/lib/doc/jao-doc-view.el +++ b/lib/doc/jao-doc-view.el @@ -1,6 +1,6 @@ ;; jao-doc-view.el -- Remembering visited documents -*- lexical-binding: t; -*- -;; Copyright (c) 2013, 2015, 2017, 2018, 2019, 2021 Jose Antonio Ortega Ruiz +;; Copyright (c) 2013, 2015, 2017, 2018, 2019, 2021, 2022 Jose Antonio Ortega Ruiz ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -30,12 +30,12 @@ (require 'doc-view) (defvar jao-doc-view-session-file "~/.emacs.d/cache/doc-view-session.eld") -(defvar-local jao-doc-view--is-pdf nil) +(defvar-local jao-doc-view--is-doc nil) -(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 - (when (derived-mode-p 'doc-view-mode 'pdf-view-mode) +(defun jao-doc-view-session-mark (path) (setq-local jao-doc-view--is-doc path)) +(defun jao-doc-view--is-doc () + (or jao-doc-view--is-doc + (when (derived-mode-p 'doc-view-mode 'pdf-view-mode 'nov-mode) (buffer-file-name)))) (defun jao-doc-view--read-file (file) @@ -61,13 +61,13 @@ (cb (when skip-current (current-buffer)))) (dolist (b (buffer-list)) (with-current-buffer b - (when-let (fn (and (not (eq cb b)) (jao-doc-view--is-pdf))) + (when-let (fn (and (not (eq cb b)) (jao-doc-view--is-doc))) (add-to-list 'docs fn)))) (when (> (length docs) 0) (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))) + (when (jao-doc-view--is-doc) (jao-doc-view-save-session t))) (defvar jao-doc-view-inhibit-session-save nil) @@ -82,6 +82,7 @@ (add-hook 'kill-buffer-hook #'jao-doc-view--save-session-1) (add-hook 'doc-view-mode-hook #'jao-doc-view--save-session) (add-hook 'pdf-view-mode-hook #'jao-doc-view--save-session) +(add-hook 'nov-mode-hook #'jao-doc-view--save-session) ;;; PDF info diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 470981d..28e6f67 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -86,7 +86,7 @@ (delete-other-windows) (split-window-right) (let ((docs (cl-remove-if-not (lambda (b) - (with-current-buffer b (jao-doc-view--is-pdf))) + (with-current-buffer b (jao-doc-view--is-doc))) (buffer-list)))) (if (car docs) (progn (switch-to-buffer (car docs)) |