summaryrefslogtreecommitdiffhomepage
path: root/lib/doc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/doc')
-rw-r--r--lib/doc/jao-org-links.el18
-rw-r--r--lib/doc/jao-org-notes.el7
2 files changed, 14 insertions, 11 deletions
diff --git a/lib/doc/jao-org-links.el b/lib/doc/jao-org-links.el
index ee6af7c..2defa7c 100644
--- a/lib/doc/jao-org-links.el
+++ b/lib/doc/jao-org-links.el
@@ -1,5 +1,6 @@
;; -*- lexical-binding: t; -*-
+(require 'jao-org-notes)
(require 'jao-maildir)
(require 'pdf-info)
@@ -122,12 +123,10 @@
(org-link-set-parameters "message" :follow #'jao-org-links-open-mail)
(setq jao-org--sink-dir (file-name-as-directory sink-dir)))
-(defvar jao-doc-notes-dir)
-
;;;###autoload
(defun jao-org-org-to-pdf-file ()
(expand-file-name (concat "doc/" (file-name-base buffer-file-name) ".pdf")
- jao-org-notes-dir))
+ (file-name-directory jao-org-notes-dir)))
;;;###autoload
(defun jao-org-pdf-to-org-file (&optional file-name)
@@ -138,15 +137,16 @@
(lambda ()
(string-prefix-p jao-org-notes-dir buffer-file-name)))
(or (car (directory-files-recursively jao-org-notes-dir rx))
- (let* ((dirs (seq-difference (directory-files jao-org-notes-dir)
- '("." ".." "attic")))
+ (let* ((dirs (jao-org-notes-cats))
(dir (completing-read "Notes subdir: " dirs nil t)))
(expand-file-name (concat dir "/" bn ".org") jao-org-notes-dir)))))
;;;###autoload
(defun jao-org-insert-doc-skeleton (&optional title)
(insert "#+title: " (or title (jao-org--pdf-title (buffer-file-name)))
- "\n#+author:\n#+startup: latexpreview\n\n"))
+ "\n#+author:\n#+filetags: ")
+ (jao-org-notes-insert-tags)
+ (insert "\n#+startup: latexpreview\n\n"))
;;;###autoload
(defun jao-org-pdf-goto-org (arg)
@@ -162,8 +162,10 @@
(org-insert-link)))))
;;;###autoload
-(defun jao-org-pdf-goto-org* ()
+(defun jao-org-org-goto-pdf ()
(interactive)
- (jao-org-pdf-goto-org t))
+ (if-let (f (jao-org-org-to-pdf-file))
+ (find-file-other-window f)
+ (user-error "No PDF file associated with this buffer")))
(provide 'jao-org-links)
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index a1b9dbe..1b8c3f8 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -63,10 +63,11 @@
:history '(:input jao-org-notes--grep-history)
:sort nil)))
+(defun jao-org-notes-cats ()
+ (seq-difference (directory-files jao-org-notes-dir) '("." ".." "attic")))
+
(defun jao-org-notes--cat ()
- (let* ((cats (seq-difference (directory-files jao-org-notes-dir)
- '("." ".." "attic")))
- (cat (completing-read "Top level category: " cats)))
+ (let* ((cat (completing-read "Top level category: " (jao-org-notes-cats))))
(cond ((file-exists-p (expand-file-name cat jao-org-notes-dir)) cat)
((yes-or-no-p "New category, create?") cat)
(t (jao-roam--cat)))))