about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el5
-rw-r--r--lisp/+org-attach.el29
2 files changed, 34 insertions, 0 deletions
diff --git a/init.el b/init.el index c47d7ea..ce2ce50 100644 --- a/init.el +++ b/init.el
@@ -646,6 +646,11 @@
646 (:hook #'hl-line-mode) 646 (:hook #'hl-line-mode)
647 (add-hook 'org-agenda-after-show-hook 'org-narrow-to-subtree)) 647 (add-hook 'org-agenda-after-show-hook 'org-narrow-to-subtree))
648 648
649(setup org-attach
650 (:also-load +org-attach)
651 (:option org-attach-method 'lns)
652 (+org-attach-fix-args-mode +1))
653
649(setup org-capture 654(setup org-capture
650 (:require +org-capture) 655 (:require +org-capture)
651 (:+leader "c" #'org-capture "C-c" #'org-capture) 656 (:+leader "c" #'org-capture "C-c" #'org-capture)
diff --git a/lisp/+org-attach.el b/lisp/+org-attach.el new file mode 100644 index 0000000..5e7cc7f --- /dev/null +++ b/lisp/+org-attach.el
@@ -0,0 +1,29 @@
1;;; +org-attach.el --- Fixes for org-attach -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;; `org-attach-attach' doesn't fix the path name. Before I submit a bug, I'm
6;; just fixing it by advising `org-attach-attach'.
7
8;;; Code:
9
10(defun +org-attach-attach-fix-args (args)
11 "ADVICE for `org-attach-attach' to normalize FILE first.
12VISIT-DIR and METHOD are passed through unchanged.
13
14This should be applied as `:filter-args' advice."
15 (cons (expand-file-name (car args)) (cdr args)))
16
17(define-minor-mode +org-attach-fix-args-mode
18 "Fix the arguments passed to `org-attach-attach'.
19This mode normalizes the filename passed to `org-attach-attach'
20so that links can be properly made."
21 :lighter ""
22 :keymap nil
23 :global t ; I figure, what does this hurt?
24 (if +org-attach-fix-args-mode
25 (advice-add 'org-attach-attach :filter-args #'+org-attach-attach-fix-args)
26 (advice-remove 'org-attach-attach #'+org-attach-attach-fix-args)))
27
28(provide '+org-attach)
29;;; +org-attach.el ends here