summaryrefslogtreecommitdiffhomepage
path: root/lib/doc/jao-doc-view.el
diff options
context:
space:
mode:
Diffstat (limited to 'lib/doc/jao-doc-view.el')
-rw-r--r--lib/doc/jao-doc-view.el17
1 files changed, 9 insertions, 8 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