summaryrefslogtreecommitdiffhomepage
path: root/doc/jao-doc-view.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@imladris.local>2019-01-09 00:23:53 +0000
committerJose Antonio Ortega Ruiz <jao@imladris.local>2019-01-09 00:23:53 +0000
commit534b998b5192ec146a33d3ba871227856a4418bc (patch)
tree4b0fe7cc9b7bd591b0d254e93faf22015167b314 /doc/jao-doc-view.el
parent7d07616a2e9b618ebb510a07437e93a341fdf00a (diff)
downloadelibs-534b998b5192ec146a33d3ba871227856a4418bc.tar.gz
elibs-534b998b5192ec146a33d3ba871227856a4418bc.tar.bz2
idle timer for doc view sessions
Diffstat (limited to 'doc/jao-doc-view.el')
-rw-r--r--doc/jao-doc-view.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/doc/jao-doc-view.el b/doc/jao-doc-view.el
index 8fce662..0398e60 100644
--- a/doc/jao-doc-view.el
+++ b/doc/jao-doc-view.el
@@ -1,6 +1,6 @@
;; jao-doc-view.el -- Remembering visited documents
-;; Copyright (c) 2013, 2015, 2017, 2018 Jose Antonio Ortega Ruiz
+;; Copyright (c) 2013, 2015, 2017, 2018, 2019 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
@@ -120,11 +120,26 @@
(jao-doc-view-purge-bmks)
(jao-doc-view-save-session t)))
+(defvar jao-doc-session-timer nil)
+(defvar jao-doc-session-timer-seconds 60)
+
+(defun jao-doc-view-stop-session-timer ()
+ (when jao-doc-session-timer
+ (cancel-timer jao-doc-session-timer)
+ (setq jao-doc-session-timer nil)))
+
+(defun jao-doc-view-start-session-timer ()
+ (setq jao-doc-session-timer
+ (run-with-idle-timer jao-doc-session-timer-seconds
+ t
+ 'jao-doc-view-save-session)))
+
(defun jao-doc-view-install ()
(jao-doc-view--current-bmks)
(add-hook 'kill-buffer-hook 'jao-doc-view--save-bmk)
(add-hook 'kill-buffer-hook 'jao-doc-view--save-session-1 t)
- (add-hook 'kill-emacs-hook 'jao-doc-view-save-session))
+ (add-hook 'kill-emacs-hook 'jao-doc-view-save-session)
+ (jao-doc-view-start-session-timer))