summaryrefslogtreecommitdiffhomepage
path: root/lib/org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-02-03 04:04:16 +0000
committerjao <jao@gnu.org>2021-02-03 04:04:16 +0000
commit50d1776b7f98d5833b4e3f9e65dce8e9d452c05e (patch)
tree2ebc00c14c4a02c1bdc736d7e6f607189f95010c /lib/org
parent535a578fd12211e6ec2293de96bb6877c4cf51c1 (diff)
downloadelibs-50d1776b7f98d5833b4e3f9e65dce8e9d452c05e.tar.gz
elibs-50d1776b7f98d5833b4e3f9e65dce8e9d452c05e.tar.bz2
jao-org-links: move to afio ws on opening doc: link
Diffstat (limited to 'lib/org')
-rw-r--r--lib/org/jao-org-links.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/org/jao-org-links.el b/lib/org/jao-org-links.el
index 7d9cb55..21bf27c 100644
--- a/lib/org/jao-org-links.el
+++ b/lib/org/jao-org-links.el
@@ -4,13 +4,16 @@
(defvar jao-org--sink-dir "./")
(defvar jao-org-open-pdf-fun 'jao-org--pdf-tools-open)
-(defun jao-org--pdf-tools-open (path page &optional height)
- (org-open-file path 1)
- (pdf-view-goto-page page)
+(defun jao-org--pdf-go (page height)
+ (when page (pdf-view-goto-page page))
(when height
(image-set-window-vscroll
(round (/ (* height (cdr (pdf-view-image-size))) (frame-char-height))))))
+(defun jao-org--pdf-tools-open (path page &optional height)
+ (org-open-file path 1)
+ (jao-org--pdf-go path page))
+
(defun jao-org--pdf-open (path page &optional height)
(funcall (or jao-org-open-pdf-fun 'jao-org--pdf-tools-open) path page height))
@@ -26,9 +29,9 @@
(jao-org--pdf-open path page height)))
((string-match "\\(.*\\)::\\([0-9]+\\)$" link)
(let* ((path (match-string 1 link))
- (page (string-to-number (match-string 2 link))))
+ (page (max 1 (string-to-number (match-string 2 link)))))
(jao-org--pdf-open path page)))
- (t (org-open-file link 1))))
+ (t (jao-org--pdf-open link nil))))
(defun jao-org-links--follow-doc (link)
(let* ((full-link (concat org-directory "/doc/" link))
@@ -41,7 +44,7 @@
(shell-command (format "mv %s %s" real-file dest-path))))
(if (jao-org--pdf-p dest-path)
(jao-org-links--open-pdf full-link)
- (browse-url (format "file://%s" (expand-file-name dest-path))))))
+ (browse-url (format "file://%s" (expand-file-name dest-path))))))
(defun jao-org-links--complete-doc (&optional arg)
(let ((default-directory jao-org--sink-dir))