summaryrefslogtreecommitdiffhomepage
path: root/lib/doc/jao-org-notes.el
diff options
context:
space:
mode:
Diffstat (limited to 'lib/doc/jao-org-notes.el')
-rw-r--r--lib/doc/jao-org-notes.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index 3f3c5ea..b7700ec 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -141,6 +141,19 @@
(buffer-file-name))
;;;###autoload
+(defun jao-org-notes-find-for-pdf (&optional file-name)
+ "Given a PDF file name, find its org notes counterpart."
+ (let* ((file-name (or file-name buffer-file-name))
+ (bn (file-name-base file-name))
+ (rx (format "%s\\.org$" (regexp-quote bn)))
+ (pred (lambda () (string-prefix-p jao-org-notes-dir buffer-file-name))))
+ (save-some-buffers nil pred)
+ (or (car (directory-files-recursively jao-org-notes-dir rx))
+ (let* ((d (completing-read "Notes subdir: " (jao-org-notes-cats) nil t))
+ (d (file-name-as-directory d)))
+ (expand-file-name (concat d bn ".org") jao-org-notes-dir)))))
+
+;;;###autoload
(defun jao-org-notes-grep ()
"Perform a grep search on all org notes body, via consult-ripgrep."
(interactive)