summaryrefslogtreecommitdiffhomepage
path: root/lib/org
diff options
context:
space:
mode:
Diffstat (limited to 'lib/org')
-rw-r--r--lib/org/jao-org-links.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/org/jao-org-links.el b/lib/org/jao-org-links.el
index f8080f5..019d26b 100644
--- a/lib/org/jao-org-links.el
+++ b/lib/org/jao-org-links.el
@@ -1,3 +1,5 @@
+-*- lexical-binding: t; -*-
+
(require 'jao-org-utils)
(require 'jao-maildir)
(require 'pdf-info)
@@ -121,20 +123,23 @@
(org-link-set-parameters "message" :follow #'jao-org-links-open-mail)
(setq jao-org--sink-dir (file-name-as-directory sink-dir)))
-;;;###autoload
-(defvar jao-org-doc-notes-dir "notes/books")
+(defvar jao-doc-notes-dir)
;;;###autoload
(defun jao-org-org-to-pdf-file ()
- (replace-regexp-in-string (format "/%s/\\(.+\\)\\.org$" jao-org-doc-notes-dir)
- "/doc/\\1.org"
- buffer-file-name))
+ (expand-file-name (concat "doc/" (file-name-base buffer-file-name) ".pdf")
+ jao-org-notes-dir))
;;;###autoload
(defun jao-org-pdf-to-org-file (&optional file-name)
- (replace-regexp-in-string "/doc/\\(.+\\)\\.pdf$"
- (format "/%s/\\1.org" jao-org-doc-notes-dir)
- (or file-name buffer-file-name)))
+ (let* ((file-name (or file-name buffer-file-name))
+ (bn (file-name-base file-name))
+ (rx (format "%s\\.org$" (regexp-quote bn))))
+ (or (car (directory-files-recursively jao-org-notes-dir rx))
+ (let* ((dirs (seq-difference (directory-files jao-org-notes-dir)
+ '("." ".." "attic")))
+ (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)