I've been using org-attach for a while but I recently changed org-attach-method from cp to mv andorg-attach no longer creates :Attachments: property. Rather, it gives an :ID: property (and moves the attachment to a folder named after the :ID: string as documented here. This is fine for me but I don't quite understand why :Attachments: is no longer created.

Also, I use :PROPERTIES: extensively (as suggested here) and headers with attachments are not distinct from headers with an :ID: but no attachment (except by the :ATTACH: tag). Moving the :ID: line in the :PROPERTIES: makes C-c C-a o not retrieving the attachment.

Is this behavior related to org-attach-method? If not, why is :Attachments: property missing?

  • FWIW, I cannot find any code that creates (or created) an Attachments property, no matter what the method is. When I try it with cp, I get an ID property. Going back through git history, I did not find anything to even suggest that an Attachments property was ever created (of course, I could have missed the change), so naturally I am intrigued: what version of Org mode are you (or were you) running when this property was being created by org-attach?
    – NickD
    Jan 28, 2020 at 16:21
  • I was using Org 9.2 and I have not realized I did switch to 9.3 in the meantime. I cannot find the Attachments property in Org documentation but I'm not sure whether it has been updated or not.
    – teabow
    Jan 28, 2020 at 16:52
  • Maybe you have (or had) a third-party packages that dealt with attachments? I don't see any trace of the property in the code.
    – NickD
    Jan 28, 2020 at 17:18
  • 1
    What does your org-attach-after-change-hook look like?
    – NickD
    Jan 28, 2020 at 18:27
  • 1
    Sorry, my mistake: it was part of 9.2.4 (variable org-file-list-property) but disappeared afterwards. The relevant commit is ae9cd437 and it went into release 9.2.5.
    – NickD
    Jan 28, 2020 at 19:23

2 Answers 2


Just to summarize the exchange in the comments:

org-attach-attach used to add an Attachments property up to, and including Org mode version 9.2.4. Since version 9.2.5 (more specifically, since commit ae9cd437) this is no longer the case. Here are the details of the relevant commit (but note that there is no mention of the specific change that is the subject of this question):

commit ae9cd4370b4daaaca7bc53923d5e438c08955e48
Author: Gustav Wikström <[email protected]>
Date:   Sun Nov 25 21:38:44 2018 +0100

    org-attach*, org, org-manual, org-news, ox-html, testing/*

    * lisp/org-attach.el

    Changed the way attachments deal with property-inheritance.  It now
    adheres to the =org-use-property-inheritance= setting by default but
    it can be customized if needed (I recommend to enable it!).
    The property ATTACH_DIR is deprecated in favour of the shorter and simpler
    property DIR.

    Added an explicit option to =org-attach= for unsetting
    attachment-directories (i.e. remove DIR property and deal with the
    attachments by interaction).

    Added attachment link type with the prefix "attachment:".

    Added customizations:
    - org-attach-dir-relative
    - org-attach-preferred-new-method
    - org-attach-use-inheritance
    - org-attach-id-to-path-function

    Hooks added:
    - org-attach-after-change-hook
    - org-attach-open-hook

    A new linktype "attachment" is added in order to reduce
    link-duplication when wanting to link to files in attached folders of
    nodes.  This works for both ID and DIR properties.  The goal is to
    make the functionality for attachment links mirror the functionality
    for file links.

    * lisp/org-attach-git.el

    New file, existing functionality.  Code here has been factored out
    from org-attach.el and if GIT-functionality is to be used this module
    needs to be required sepatately.  It extends org-attach by use of its

    Activating git functionality in org-attach is done by loading
    org-attach-git from now on, instead of customizing a variable.

    Naming of both functions and tests has been modified to match the move
    of functionality into its own module.

    * lisp/org.el

    Inline images are shown also using attachment-links, exactly the same
    as it works for file-links today.

    Make org-open-at-point respect ARG when opening attachment-dir.

    * lisp/org-compat.el

    org-attach-directory has been deprecated in favour for
    org-attach-id-dir.  The new name matches its purpose better.

    * lisp/ox-html.el

    Export attachment links to images as inline images, in the same way as
    file links work today.

    * etc/ORG-NEWS

    Mention the changes in this patch.

    * doc/org-manual.org

    The chapter "Refile, Copy, Archive" has been split into two separate
    - "Refile, Copy and Archiving" for information related to moving
      existing data around.

    - "Capture, Attachments, RSS Feeds and Protocols" for information
      related to working with external data.

    The attachment-part has been rewritten and extended to match the
    changes in this patch.

    The new attachment link type is mentioned both inside the attachments
    chapter and in the chapter dealing with links.

    Documentation related to external links has been improved.

    * testing/lisp/test-org-attach-annex.el

    Require org-attach-git instead of org-attach, since this file tests
    the GIT-functionality.

    * testing/lisp/test-org-attach.el

    Add tests for org-attach.

    * testing/org-test.el

    Define a symbol for a file to test attachments with.

    * testing/examples/*

    A bunch of new example files and folders are created and are used in
    testing of org-attach to verify its functionality.

It is almost possible to reimplement the old functionality using the new org-attach-after-change-hook, but not quite: the hook is run with arguments like this:

    (run-hook-with-args 'org-attach-after-change-hook attach-dir)

So you could define a function that adds the property:

(defun org-add-attachment-property (file)
   (let ((basename (file-name-nondirectory file)))
    (when (and org-attach-file-list-property (not org-attach-inherited))
       (point) "Attachments" basename))))

(add-hook 'org-attach-after-change-hook 'org-add-attachment-property)

except that the hook is run with the "wrong" argument: instead of being run with the original file, it is run with the attach directory instead, and I'm not sure why: it might be better to run it with both arguments to provide additional flexibility - run the hook like this:

    (run-hook-with-args 'org-attach-after-change-hook attach-dir file)

and change the function definition so that it starts with:

(defun org-add-attachment-property (attach-dir file)

The function will ignore the attach-dir argument and deal with the file only.

But this will require changes to Org mode code, and therefore an enhancement request to the Org mode mailing list.

  • Edited to add code for an almost-but-not-quite reimplementation of the original Attachments functionality.
    – NickD
    Jan 29, 2020 at 3:07
  • Well, thank you Nick, you've been way further than what I was asking for!
    – teabow
    Jan 30, 2020 at 9:33

Found the code which adds files you've attached to the heading's property.

    (defun org-attach-save-file-list-to-property (dir)
      "Save list of attachments to ORG_ATTACH_FILES property."
      (when-let* ((files (org-attach-file-list dir)))
        (org-set-property "ORG_ATTACH_FILES" (mapconcat #'identity files ", "))))
    (add-hook 'org-attach-after-change-hook #'org-attach-save-file-list-to-property)

So after attaching the file vlc-record-2022-01-17-23h36m23s-listen-.mp3 it will result in creating *:ORG_ATTACH_FILES: property with list of attached files.

    *** task 8                                                    :ATTACH:
    :CREATED:  [2023-01-06 Fri 13:36]
    :ORG_ATTACH_FILES: vlc-record-2022-01-17-23h36m23s-listen-.mp3
    :ID:       2023-01-06-task-8

Tested with GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32) of 2022-09-14.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.