diff options
author | Gustav Wikström <gustav@whil.se> | 2019-12-13 23:01:10 +0100 |
---|---|---|
committer | Gustav Wikström <gustav@whil.se> | 2019-12-13 23:01:10 +0100 |
commit | 26ace9004260a056acef58a7c1c80222bc9587c9 (patch) | |
tree | e49e9c3bf5409a68e4c083bf7ccb0ccc9ce61496 | |
parent | 31d2f48f69d07ac2ce1c328a3bb96c5a5782b812 (diff) | |
download | org-mode-26ace9004260a056acef58a7c1c80222bc9587c9.tar.gz |
Make org-attach store links using attachment-links
* lisp/org-attach.el (org-attach-attach): Storing links using the new
attachment link type instead of file links.
* lisp/org-compat.el (org-attach-store-link, org-attach-expand-link):
Remove not needed functions and mark them as obsolete for easier
future reference.
-rw-r--r-- | lisp/org-attach.el | 22 | ||||
-rw-r--r-- | lisp/org-compat.el | 2 |
2 files changed, 8 insertions, 16 deletions
diff --git a/lisp/org-attach.el b/lisp/org-attach.el index c8ce326..2c5558b 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -457,14 +457,6 @@ DIR-property exists (that is different than the unset one)." "Turn the autotag off." (org-attach-tag 'off)) -(defun org-attach-store-link (file) - "Add a link to `org-stored-link' when attaching a file. -Only do this when `org-attach-store-link-p' is non-nil." - (setq org-stored-links - (cons (list (org-attach-expand-link file) - (file-name-nondirectory file)) - org-stored-links))) - (defun org-attach-url (url) (interactive "MURL of the file to attach: \n") (let ((org-attach-method 'url)) @@ -511,9 +503,13 @@ METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from (run-hook-with-args 'org-attach-after-change-hook attach-dir) (org-attach-tag) (cond ((eq org-attach-store-link-p 'attached) - (org-attach-store-link fname)) + (push (list (concat "attachment:" (file-name-nondirectory fname)) + (file-name-nondirectory fname)) + org-stored-links)) ((eq org-attach-store-link-p t) - (org-attach-store-link file))) + (push (list (concat "file:" file) + (file-name-nondirectory file)) + org-stored-links))) (if visit-dir (dired attach-dir) (message "File %S is now an attachment." basename))))) @@ -642,12 +638,6 @@ See `org-attach-open'." Basically, this adds the path to the attachment directory." (expand-file-name file (org-attach-dir))) -(defun org-attach-expand-link (file) - "Return a file link pointing to the current entry's attachment file FILE. -Basically, this adds the path to the attachment directory, and a \"file:\" -prefix." - (concat "file:" (org-attach-expand file))) - (org-link-set-parameters "attachment" :follow #'org-attach-open-link :export #'org-attach-export-link diff --git a/lisp/org-compat.el b/lisp/org-compat.el index c167ba9..4da9f22 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -314,6 +314,8 @@ Counting starts at 1." (define-obsolete-variable-alias 'org-attach-directory 'org-attach-id-dir "Org 9.3") +(make-obsolete 'org-attach-store-link "No longer used" "Org 9.4") +(make-obsolete 'org-attach-expand-link "No longer used" "Org 9.4") (defun org-in-fixed-width-region-p () "Non-nil if point in a fixed-width region." |