about summary refs log tree commit diff stats
path: root/lisp/+org-attach.el
diff options
context:
space:
mode:
authorCase Duckworth2022-02-16 23:17:01 -0600
committerCase Duckworth2022-02-16 23:17:01 -0600
commit5666ae8631c99a52b95087863bcef6d6436f35f0 (patch)
tree3e6d1b1641fbc791dadcb68ab57d8d7727b2d5ba /lisp/+org-attach.el
parentChange the dang ol' org font stuff (diff)
downloademacs-5666ae8631c99a52b95087863bcef6d6436f35f0.tar.gz
emacs-5666ae8631c99a52b95087863bcef6d6436f35f0.zip
Fix org-attach
I should send a bug report...
Diffstat (limited to 'lisp/+org-attach.el')
-rw-r--r--lisp/+org-attach.el29
1 files changed, 29 insertions, 0 deletions
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