diff options
author | jao <jao@gnu.org> | 2022-08-30 12:00:04 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-08-30 12:00:04 +0100 |
commit | 7df1e0400ee5496535ff709caee54fb750af2c04 (patch) | |
tree | 2f4da48ebceac2201f77b58afc02fccede3f912d /lib | |
parent | cccf4658ed4e9f900477698fb19af37634093059 (diff) | |
download | elibs-7df1e0400ee5496535ff709caee54fb750af2c04.tar.gz elibs-7df1e0400ee5496535ff709caee54fb750af2c04.tar.bz2 |
jao-pdf &co.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/doc/jao-org-links.el | 17 | ||||
-rw-r--r-- | lib/doc/jao-pdf.el | 4 |
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/doc/jao-org-links.el b/lib/doc/jao-org-links.el index c1995dd..f75ca3e 100644 --- a/lib/doc/jao-org-links.el +++ b/lib/doc/jao-org-links.el @@ -1,22 +1,18 @@ ;; -*- lexical-binding: t; -*- -(require 'pdf-tools nil t) - (require 'jao-org-notes) (require 'jao-doc-view) (require 'jao-pdf) -(declare pdf-info-outline "pdf-info") - (defvar jao-org--sink-dir "./") -(defvar jao-org-open-pdf-fun #'jao-org--pdf-tools-open) +(defvar jao-org-open-pdf-fun #'jao-org--pdf-open) -(defun jao-org--pdf-tools-open (path page &optional height) +(defun jao-org--pdf-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-tools-open) path page height)) + (funcall (or jao-org-open-pdf-fun #'jao-org--pdf-open) path page height)) (defun jao-org-links--open-pdf (link) "Open LINK in pdf-view-mode." @@ -120,12 +116,15 @@ (defun jao-org-pdf-goto-org* () (interactive) (jao-org-pdf-goto-org t)) ;;;###autoload -(defun jao-org-org-goto-pdf () +(defun jao-org-goto-pdf () (interactive) (if-let (f (jao-org-org-to-pdf-file)) - (find-file-other-window f) + (funcall jao-org-open-pdf-fun f 1) (user-error "No PDF file associated with this buffer"))) +(with-eval-after-load "org" + (define-key org-mode-map (kbd "C-c o") #'jao-org-org-goto-pdf)) + ;;;###autoload (defun jao-org-links-setup (sink-dir) (interactive) diff --git a/lib/doc/jao-pdf.el b/lib/doc/jao-pdf.el index 6158306..6274cbb 100644 --- a/lib/doc/jao-pdf.el +++ b/lib/doc/jao-pdf.el @@ -73,7 +73,9 @@ The result is cached as a local buffer variable." (defun jao-pdf-section-title (&optional page file-name) (when (not jao-pdf--outline) (setq-local jao-pdf--outline (jao-pdf-outline file-name))) - (let ((page (or page (jao-pdf-current-page))) + (let ((page (or page + (and (derived-mode-p 'doc-view-mode) (doc-view-current-page)) + (and (derived-mode-p 'pdf-view) (pdf-view-current-page)))) (outline jao-pdf--outline) (cur-page 0) (cur-title (jao-pdf-title (or file-name buffer-file-name "title")))) |