Last active
February 25, 2022 14:54
-
-
Save linktohack/8ecf1e8951f6adc0dd1cf742b19e979f to your computer and use it in GitHub Desktop.
Org Sync attachments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun org-sync-attachments () | |
"Update the current entry's attachment metadata." | |
(interactive) | |
(let* ((attachments (if (org-attach-dir) | |
(org-attach-file-list (org-attach-dir)))) | |
(tag-state (if attachments 'on 'off)) | |
(org-attach-file-list-property "Attachments")) | |
(if attachments | |
(org-set-property org-attach-file-list-property | |
(mapconcat #'url-encode-url | |
attachments " ")) | |
(org-delete-property org-attach-file-list-property)) | |
(org-toggle-tag org-attach-auto-tag tag-state))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment