Function: org-attach-sync

org-attach-sync is an interactive and byte-compiled function defined in org-attach.el.gz.

Signature

(org-attach-sync)

Documentation

Synchronize the current outline node with its attachments.

Useful after files have been added/removed externally. Option org-attach-sync-delete-empty-dir controls the behavior for empty attachment directories.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-attach.el.gz
(defun org-attach-sync ()
  "Synchronize the current outline node with its attachments.
Useful after files have been added/removed externally.  Option
`org-attach-sync-delete-empty-dir' controls the behavior for
empty attachment directories."
  (interactive)
  (let ((attach-dir (org-attach-dir)))
    (if (not attach-dir)
        (org-attach-tag 'off)
      (run-hook-with-args 'org-attach-after-change-hook attach-dir)
      (let ((files (org-attach-file-list attach-dir)))
	(org-attach-tag (not files)))
      (when org-attach-sync-delete-empty-dir
        (when (and (org-directory-empty-p attach-dir)
                   (if (eq 'query org-attach-sync-delete-empty-dir)
                       (yes-or-no-p "Attachment directory is empty.  Delete?")
                     t))
          (delete-directory attach-dir))))))