Skip to main content

10.2.2 Attachment options

There are a couple of options for attachments that are worth mentioning.

org-attach-id-dir​

The directory where attachments are stored when ‘ID’ is used as method.

org-attach-dir-relative​

When setting the ‘DIR’ property on a node using C-c C-a s (org-attach-set-directory), absolute links are entered by default. This option changes that to relative links.

org-attach-use-inheritance​

By default folders attached to an outline node are inherited from parents according to org-use-property-inheritance. If one instead want to set inheritance specifically for Org attach that can be done using org-attach-use-inheritance. Inheriting documents through the node hierarchy makes a lot of sense in most cases. Especially when using attachment links (see Attachment links). The following example shows one use case for attachment inheritance:

* Chapter A ...
:PROPERTIES:
:DIR: Chapter A/
:END:
** Introduction
Some text

#+NAME: Image 1
[[attachment:image 1.jpg]]

Without inheritance one would not be able to resolve the link to ‘image 1.jpg’, since the link is inside a sub-heading to ‘Chapter A’.

Inheritance works the same way for both ‘ID’ and ‘DIR’ property. If both properties are defined on the same headline then ‘DIR’ takes precedence. This is also true if inheritance is enabled. If ‘DIR’ is inherited from a parent node in the outline, that property still takes precedence over an ‘ID’ property defined on the node itself.

org-attach-method​

When attaching files using the dispatcher C-c C-a it defaults to copying files. The behavior can be changed by customizing org-attach-method. Options are Copy, Move/Rename, Hard link or Symbolic link.

org-attach-preferred-new-method​

This customization lets you choose the default way to attach to nodes without existing ‘ID’ and ‘DIR’ property. It defaults to id but can also be set to dir, ask or nil.

org-attach-archive-delete​

Configure this to determine if attachments should be deleted or not when a subtree that has attachments is archived.

org-attach-auto-tag​

When attaching files to a heading it will be assigned a tag according to what is set here.

org-attach-id-to-path-function-list​

When ‘ID’ is used for attachments, the ID is parsed into a part of a directory-path. See org-attach-id-uuid-folder-format for the default function. Define a new one and add it as first element in org-attach-id-to-path-function-list if you want the folder structure in any other way. All functions in this list will be tried when resolving existing ID’s into paths, to maintain backward compatibility with existing folders in your system.

Stores a link to the file that is being attached. The link is stored in org-stored-links for later insertion with C-c C-l (see Handling Links). Depending on what option is set in org-attach-store-link-p, the link is stored to either the original location as a file link, the attachment location as an attachment link or to the attachment location as a file link.

org-attach-commands​

List of all commands used in the attach dispatcher.

org-attach-expert​

Do not show the splash buffer with the attach dispatcher when org-attach-expert is set to non-nil.

See customization group ‘Org Attach’ if you want to change the default settings.