summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-08-30 12:00:04 +0100
committerjao <jao@gnu.org>2022-08-30 12:00:04 +0100
commit7df1e0400ee5496535ff709caee54fb750af2c04 (patch)
tree2f4da48ebceac2201f77b58afc02fccede3f912d
parentcccf4658ed4e9f900477698fb19af37634093059 (diff)
downloadelibs-7df1e0400ee5496535ff709caee54fb750af2c04.tar.gz
elibs-7df1e0400ee5496535ff709caee54fb750af2c04.tar.bz2
jao-pdf &co.
-rw-r--r--custom/jao-custom-exwm.el3
-rw-r--r--lib/doc/jao-org-links.el17
-rw-r--r--lib/doc/jao-pdf.el4
3 files changed, 12 insertions, 12 deletions
diff --git a/custom/jao-custom-exwm.el b/custom/jao-custom-exwm.el
index 1a11cd4..842fd1a 100644
--- a/custom/jao-custom-exwm.el
+++ b/custom/jao-custom-exwm.el
@@ -368,7 +368,6 @@
(defun jao-exwm-pdf-disable-zathura ()
(interactive)
- (define-key org-mode-map (kbd "C-c o") #'jao-org-org-goto-pdf)
(remove-hook 'kill-emacs-query-functions #'jao-exwm-pdf-zathura-close-all)
(setq jao-browse-doc-use-emacs-p t)
(setq jao-org-open-pdf-fun #'jao-find-or-open)
@@ -378,7 +377,7 @@
(defun jao-exwm-zathura-goto-pdf ()
(interactive)
(if jao-browse-doc-use-emacs-p
- (jao-org-org-goto-pdf)
+ (jao-org-goto-pdf)
(when-let (pdf (jao-org-org-to-pdf-file))
(jao-zathura-open-doc pdf))))
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"))))