diff options
author | jao <jao@gnu.org> | 2022-08-13 19:44:05 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-08-13 19:44:05 +0100 |
commit | 460d921de8788a7ae8dfaebcf5aec0d776d3cbd5 (patch) | |
tree | e4494093353f2377af84f6f7f8191e5e067fc249 /lib/doc | |
parent | 65855b5c9980ff282234fb91a82a45d75b67f8c1 (diff) | |
download | elibs-460d921de8788a7ae8dfaebcf5aec0d776d3cbd5.tar.gz elibs-460d921de8788a7ae8dfaebcf5aec0d776d3cbd5.tar.bz2 |
jao-doc-session: using it
Diffstat (limited to 'lib/doc')
-rw-r--r-- | lib/doc/jao-doc-view.el | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/lib/doc/jao-doc-view.el b/lib/doc/jao-doc-view.el index 03fd5c1..3973104 100644 --- a/lib/doc/jao-doc-view.el +++ b/lib/doc/jao-doc-view.el @@ -18,66 +18,8 @@ ;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> ;; Start date: Fri Feb 15, 2013 01:21 - -;;; Session - (require 'doc-view) -(defvar jao-doc-view-session-file "~/.emacs.d/cache/doc-view-session.eld") -(defvar-local jao-doc-view--is-doc nil) - -(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) - (let ((buff (find-file-noselect file))) - (ignore-errors - (with-current-buffer buff - (goto-char (point-min))) - (read buff)))) - -(defun jao-doc-view--save-to-file (file value) - (with-current-buffer (find-file-noselect file) - (erase-buffer) - (insert (format "%S" value)) - (save-buffer))) - -(defun jao-doc-view-session (&optional file) - (let ((file (or file jao-doc-view-session-file))) - (jao-doc-view--read-file file))) - -(defun jao-doc-view-save-session (&optional skip-current) - (interactive) - (let ((docs '()) - (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-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-doc) (jao-doc-view-save-session t))) - -(defvar jao-doc-view-inhibit-session-save nil) - -(defun jao-doc-view--save-session () - (let ((inhibit-message t) - (message-log-max nil)) - (when (not jao-doc-view-inhibit-session-save) - (jao-doc-view-save-session)) - t)) - -(add-hook 'kill-emacs-query-functions #'jao-doc-view--save-session) -(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 (defvar-local jao--pdf-outline nil) |