summaryrefslogtreecommitdiffhomepage
path: root/lib/doc/jao-org-links.el
diff options
context:
space:
mode:
Diffstat (limited to 'lib/doc/jao-org-links.el')
-rw-r--r--lib/doc/jao-org-links.el34
1 files changed, 15 insertions, 19 deletions
diff --git a/lib/doc/jao-org-links.el b/lib/doc/jao-org-links.el
index acfe176..8b5c42e 100644
--- a/lib/doc/jao-org-links.el
+++ b/lib/doc/jao-org-links.el
@@ -77,25 +77,21 @@
(insert (format "[[doc:%s][%s]]" (jao-pdf-title-to-file-name title) title)))
;;;###autoload
-(defun jao-org-org-to-pdf-file ()
- (expand-file-name (concat "doc/" (file-name-base buffer-file-name) ".pdf")
- (file-name-directory jao-org-notes-dir)))
-
-;;;###autoload
-(defun jao-org-pdf-to-org-file (&optional file-name no-ask)
- (let* ((file-name (or file-name buffer-file-name))
- (bn (file-name-base file-name))
- (rx (format "%s\\.org$" (regexp-quote bn))))
- (save-some-buffers nil
- (lambda ()
- (string-prefix-p jao-org-notes-dir buffer-file-name)))
- (or (car (directory-files-recursively jao-org-notes-dir rx))
- (let ((d (if no-ask
- ""
- (concat (completing-read "Notes subdir: "
- (jao-org-notes-cats) nil t)
- "/"))))
- (expand-file-name (concat dir bn ".org") jao-org-notes-dir)))))
+(defun jao-org-open-from-zathura (title &optional no-ask)
+ (when-let* ((info (jao-pdf-zathura-file-info title))
+ (pdf-file (car info))
+ (page (cadr info))
+ (file (jao-org-notes-find-for-pdf pdf-file)))
+ (ignore-errors (jao-afio-goto-docs))
+ (let ((exists (file-exists-p file)))
+ (find-file file)
+ (unless exists (jao-org-insert-doc-skeleton))
+ (let ((lnk (jao-pdf--zathura-link info)))
+ (jao-doc-session-mark)
+ (if (or (not exists) (and (not no-ask) (y-or-n-p "Insert link?")))
+ (insert lnk "\n")
+ (kill-new lnk)
+ (message "Link to %s (%s) killed" file page))))))
;;;###autoload
(defun jao-org-insert-doc-skeleton (&optional title)