Skip to content

Instantly share code, notes, and snippets.

@linktohack
Last active February 25, 2022 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linktohack/8ecf1e8951f6adc0dd1cf742b19e979f to your computer and use it in GitHub Desktop.
Save linktohack/8ecf1e8951f6adc0dd1cf742b19e979f to your computer and use it in GitHub Desktop.
Org Sync attachments
(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