diff options
author | jao <jao@gnu.org> | 2022-08-29 20:32:36 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-08-29 20:32:36 +0100 |
commit | dc808512b9ec2fa10d1f134b34a8f31dbc1bdffc (patch) | |
tree | aa529fa0f9d213b82234099e293886dfb4972783 /lib | |
parent | 7064d9fb37614d8aeca097a829868d4024d517c1 (diff) | |
download | elibs-dc808512b9ec2fa10d1f134b34a8f31dbc1bdffc.tar.gz elibs-dc808512b9ec2fa10d1f134b34a8f31dbc1bdffc.tar.bz2 |
zathura improvements, and relevant orgs in doc session too
Diffstat (limited to 'lib')
-rw-r--r-- | lib/doc/jao-doc-session.el | 4 | ||||
-rw-r--r-- | lib/doc/jao-pdf.el | 7 | ||||
-rw-r--r-- | lib/eos/jao-afio.el | 11 |
3 files changed, 15 insertions, 7 deletions
diff --git a/lib/doc/jao-doc-session.el b/lib/doc/jao-doc-session.el index 9a3193f..3eee781 100644 --- a/lib/doc/jao-doc-session.el +++ b/lib/doc/jao-doc-session.el @@ -43,14 +43,14 @@ (let ((file (or file jao-doc-session-file))) (jao-doc-session--read-file file))) -(defun jao-doc-session-save (&optional skip-current) +(defun jao-doc-session-save (&optional skip-current force) (interactive) (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 (> (length docs) 0) + (when (or force (> (length docs) 0)) (jao-doc-session--save-to-file jao-doc-session-file docs)))) (defun jao-doc-session--save-session () diff --git a/lib/doc/jao-pdf.el b/lib/doc/jao-pdf.el index 62dfc08..6158306 100644 --- a/lib/doc/jao-pdf.el +++ b/lib/doc/jao-pdf.el @@ -26,6 +26,8 @@ ;; section title of a given page. ;; - Interoperability with zathura. +(require 'jao-doc-session) + ;;; PDF info (declare-function 'pdf-info-outline "pdf-info") @@ -83,6 +85,10 @@ The result is cached as a local buffer variable." (replace-regexp-in-string "[[:blank:]]+" " " cur-title))) ;;; zathura interop +(defun jao-pdf-zathura-open-cmd (file page &optional suffix) + (let ((page (if page (format "-P %s" page) ""))) + (format "zathura %s %s %s" file page (or suffix "")))) + (defun jao-pdf-zathura-file-info (title) (when (string-match "\\(.+\\) \\[\\(.+\\) (\\([0-9]+\\)/\\([0-9]+\\))\\]" title) @@ -104,6 +110,7 @@ The result is cached as a local buffer variable." (let* ((fn (file-name-nondirectory pdf-file)) (desc (jao-pdf-section-title page pdf-file)) (lnk (format "[[doc:%s::%d][%s]]" fn page desc))) + (jao-doc-session-mark) (if (or (not exists) (and (not no-ask) (y-or-n-p "Insert link?"))) (insert lnk "\n") (kill-new lnk) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 092a902..f57838a 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -51,11 +51,11 @@ ;;; session openers ;;;###autoload -(defun jao-afio-open-pdf-session () +(defun jao-afio-open-pdf-session (&optional docs) (interactive) (let ((jao-doc-session-inhibit-save t)) - (dolist (doc (jao-doc-session)) - (when (and (file-exists-p doc) (y-or-n-p (format "Open %s? " doc))) + (dolist (doc (or docs (jao-doc-session))) + (when (file-exists-p doc) (jao-open-doc doc) (other-window 1))) (other-window 1))) @@ -68,8 +68,9 @@ (if (car docs) (progn (switch-to-buffer (car docs)) (switch-to-buffer-other-window (or (cadr docs) (car docs)))) - (when (and (jao-doc-session) (y-or-n-p "Load saved session? ")) - (jao-afio-open-pdf-session))))) + (when-let (docs (jao-doc-session)) + (when (y-or-n-p (format "Load saved session? (%d docs)" (length docs))) + (jao-afio-open-pdf-session docs)))))) (declare w3m "w3m") (declare w3m-alive-p "w3m") |