org-attach-attach: Avoid linking to path starting with ~

* lisp/org-attach.el (org-attach-attach): Auto-expand ~ in the file
patch when using symlink (`lns') attach method.

Fixes https://orgmode.org/list/CAN_Dec_LyTKgSN_kiftee9GULM7FPER5frQFant3n_2C3cwM-g@mail.gmail.com
This commit is contained in:
Ihor Radchenko 2022-04-30 11:27:30 +08:00
parent 4e42500613
commit ad304faea1
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -525,7 +525,8 @@ METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
((eq method 'mv) (rename-file file attach-file))
((eq method 'cp) (copy-file file attach-file))
((eq method 'ln) (add-name-to-file file attach-file))
((eq method 'lns) (make-symbolic-link file attach-file))
;; We pass integer third argument to auto-expand "~" in FILE.
((eq method 'lns) (make-symbolic-link file attach-file 1))
((eq method 'url) (url-copy-file file attach-file)))
(run-hook-with-args 'org-attach-after-change-hook attach-dir)
(org-attach-tag)