diff options
author | jao <jao@gnu.org> | 2020-08-03 22:43:48 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-08-03 22:43:48 +0100 |
commit | 9b90f60ab815752197110a5d2a224ca9ee69fb08 (patch) | |
tree | 3135e1d670bd6be3210d86425d1d062debdcf592 /org | |
parent | 54ee84cb8742e03e531d7f82400aed4bea28b1eb (diff) | |
download | elibs-9b90f60ab815752197110a5d2a224ca9ee69fb08.tar.gz elibs-9b90f60ab815752197110a5d2a224ca9ee69fb08.tar.bz2 |
jao-org tweaks
Diffstat (limited to 'org')
-rw-r--r-- | org/jao-org-links.el | 15 | ||||
-rw-r--r-- | org/jao-org-pdfview.el | 3 | ||||
-rw-r--r-- | org/jao-org-utils.el | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/org/jao-org-links.el b/org/jao-org-links.el index fcb0825..bd3512e 100644 --- a/org/jao-org-links.el +++ b/org/jao-org-links.el @@ -23,10 +23,7 @@ (defvar jao-org--sink-dir "./") (defun jao-org-follow-doc (link) - (let ((dest-path (concat "./doc/" - (and (boundp 'docs-dir) - (concat (symbol-name docs-dir) "/")) - link))) + (let ((dest-path (concat org-directory "/doc/" link))) (when (not (file-exists-p dest-path)) (let* ((sink-file (expand-file-name link jao-org--sink-dir)) (real-file (if (file-exists-p sink-file) sink-file @@ -35,15 +32,23 @@ (shell-command (format "mv %s %s" real-file dest-path)))) (browse-url (format "file://%s" (expand-file-name dest-path))))) +(defun jao-org-complete-doc (&optional arg) + (let ((default-directory jao-org--sink-dir)) + (replace-regexp-in-string "^file:" "doc:" (org-file-complete-link arg)))) + (defsubst jao-org--title->file (title) (concat (mapconcat 'downcase (split-string title nil t) "-") ".pdf")) +;;;###autoload (defun jao-org-insert-doc (title) (interactive "sDocument title: ") (insert (format "[[doc:%s][%s]]" (jao-org--title->file title) title))) +;;;###autoload (defun jao-org-links-setup (sink-dir) - (org-add-link-type "doc" 'jao-org-follow-doc 'identity) + (org-link-set-parameters "doc" + :follow #'jao-org-follow-doc + :complete #'jao-org-complete-doc) (setq jao-org--sink-dir (file-name-as-directory sink-dir))) (provide 'jao-org-links) diff --git a/org/jao-org-pdfview.el b/org/jao-org-pdfview.el index 6c8fb60..2f38160 100644 --- a/org/jao-org-pdfview.el +++ b/org/jao-org-pdfview.el @@ -91,7 +91,8 @@ and append it." (org-link-set-parameters "pdfview" :follow #'org-pdfview-open :complete #'org-pdfview-complete-link - :store #'org-pdfview-store-link) + :store #'org-pdfview-store-link + :export #'org-pdfview-export) (provide 'jao-org-pdfview) ;;; jao-org-pdfview.el ends here diff --git a/org/jao-org-utils.el b/org/jao-org-utils.el index aa41143..8d65ed7 100644 --- a/org/jao-org-utils.el +++ b/org/jao-org-utils.el @@ -19,6 +19,7 @@ 'jao-org-link-at-point) (eldoc-mode)) +;;;###autoload (defun jao-org-utils-eldoc-setup () (add-hook 'org-mode-hook 'jao-org-eldoc--hook)) @@ -33,6 +34,7 @@ (defun jao-org--refile-target-verify () (not (looking-at-p ".*\\[\\[.+$"))) +;;;###autoload (defun jao-org-utils-setup () (setq org-refile-target-verify-function 'jao-org--refile-target-verify) (add-hook 'org-mode-hook 'jao-org--show-if-hidden t)) |