summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-01 04:07:54 +0100
committerjao <jao@gnu.org>2022-09-01 04:07:54 +0100
commit68d9a048cdd05d19fe79f87a2ec32dde14fd282b (patch)
tree443cd9e5bbbc201ad2add60df306f8173e8c375b /lib
parent83d903b05d311f1811cdab188775a665f173600e (diff)
downloadelibs-68d9a048cdd05d19fe79f87a2ec32dde14fd282b.tar.gz
elibs-68d9a048cdd05d19fe79f87a2ec32dde14fd282b.tar.bz2
doc session: allowing a buffer to register more than one file
Diffstat (limited to 'lib')
-rw-r--r--lib/doc/jao-doc-session.el8
-rw-r--r--lib/doc/jao-org-links.el10
2 files changed, 11 insertions, 7 deletions
diff --git a/lib/doc/jao-doc-session.el b/lib/doc/jao-doc-session.el
index 3eee781..669b191 100644
--- a/lib/doc/jao-doc-session.el
+++ b/lib/doc/jao-doc-session.el
@@ -48,8 +48,8 @@
(let ((docs '())
(cb (and skip-current (current-buffer))))
(dolist (b (buffer-list))
- (when-let (fn (and (not (eq cb b)) (jao-doc-session-is-doc b)))
- (add-to-list 'docs fn)))
+ (when-let (fs (and (not (eq cb b)) (jao-doc-session-is-doc b)))
+ (dolist (f fs) (add-to-list 'docs f))))
(when (or force (> (length docs) 0))
(jao-doc-session--save-to-file jao-doc-session-file docs))))
@@ -60,7 +60,9 @@
t))
(defun jao-doc-session-mark (&optional path)
- (setq jao-doc-session--is-doc (or path (buffer-file-name)))
+ (unless (listp jao-doc-session--is-doc)
+ (setq jao-doc-session--is-doc (ensure-list jao-doc-session--is-doc)))
+ (cl-pushnew (or path (buffer-file-name)) jao-doc-session--is-doc)
(jao-doc-session--save-session))
(defun jao-doc-session--save-1 ()
diff --git a/lib/doc/jao-org-links.el b/lib/doc/jao-org-links.el
index d6bb8dc..dd8f2bb 100644
--- a/lib/doc/jao-org-links.el
+++ b/lib/doc/jao-org-links.el
@@ -2,17 +2,19 @@
(require 'jao-org-notes)
(require 'jao-doc-view)
+(require 'jao-doc-session)
(require 'jao-pdf)
(defvar jao-org--sink-dir "./")
-(defvar jao-org-open-pdf-fun #'jao-org--pdf-open)
+(defvar jao-org-open-pdf-fun #'jao-org--default-open)
-(defun jao-org--pdf-open (path page &optional height)
+(defun jao-org--default-open (path page &optional height)
(org-open-file path 1)
(jao-doc-view-goto-page page height))
(defun jao-org--pdf-open (path page &optional height)
- (funcall (or jao-org-open-pdf-fun #'jao-org--pdf-open) path page height))
+ (when (file-exists-p path) (jao-doc-session-mark path))
+ (funcall (or jao-org-open-pdf-fun #'jao-org--default-open) path page height))
(defun jao-org-links--open-pdf (link)
"Open LINK in pdf-view-mode."
@@ -119,7 +121,7 @@
(defun jao-org-goto-pdf ()
(interactive)
(if-let (f (jao-org-org-to-pdf-file))
- (funcall jao-org-open-pdf-fun f 1)
+ (jao-org--pdf-open f nil)
(user-error "No PDF file associated with this buffer")))
(with-eval-after-load "org"