4 ms·
> by linking to .xlsx and .docx files but I reorganize my folder structures too often to make such file links stable. Linking implies too many manual operation
by alessivs 6y ago
> by linking to .xlsx and .docx files but I reorganize my folder structures too often to make such file links stable.
Linking implies too many manual operations to keep things tidy when moving headings around. Try Org attachments[1].
- Basically, a heading has an attachment directory, whose name is by default generated by Org, and optionally inherited from some level in the outline hierarchy.
- Any attachment is represented by a heading with the :ATTACH: tag and an ID in the :ID: property of its drawer. Actual files can be e.g. copied, moved, or symlinked.
- Attachment directories, the :ATTACH: tag and :ID: property are conveniently added by one of the attach commands, but can also be customized (`org-attach' is the dispatcher, bound by default to <C-c C-a>).
- For a given heading, run a command (conveniently, from the dispatcher) to visit the attachment directory for the heading from the configured file browser or Dired: <C-c C-a f> and <C-c C-a F>, respectively.
If it makes sense to move attachments when moving headings around, or when otherwise adding files externally to the attachment directory, there is `org-attach-sync' (<C-c C-a z>):
Synchronize the current task with its attachment directory, in case you added attachments yourself.
[1]: https://orgmode.org/manual/Attachments.html https://orgmode.org/manual/Attachments.html
- alessivs 6y agoFurther explanation: When moving headings around, one can choose to also move the attachments along, for example, by relying on OLD-HEADING and NEW-HEADING's respective attachment directories. Changes to these directories can include external modifications (e.g. addition of files produced by a spreadsheet app). `org-attach-sync' makes sure these changes are propagated to the Org file (and/or its memory representation). When referencing one of the attached files within the heading, one can use the `attachment' link type, which points to files resolving to the attachment directory[1]. The format is [[attachment:FILE-IN-ATTACHMENT-DIR][DESCRIPTION]] and can be easily inserted with completion by `org-insert-link'. For more complicated attachment linking scenarios it might be better to configure the attachment directory to be absolute (`org-attach-id-dir'). Conclusion: The use of Org attachments and the attachment: link type stabilizes links to files. [1]: https://orgmode.org/manual/Attachment-links.html https://orgmode.org/manual/Attachment-links.html