The Basics of Emacs Org Attach

Explain attachment concept

Storing files in files

Create folder and some files

Create org file

C-c C-a

Various options

https://orgmode.org/manual/Attachments.html#Attachments

Absolute/relative path

/data

Attach files from dired

;; Copy and attach files to org headers using dired
(add-hook 'dired-mode-hook
    (lambda ()
      (define-key dired-mode-map (kbd "C-c C-x c")
        (lambda ()
    (interactive)
    (let ((org-attach-method 'cp))
      (call-interactively #'org-attach-dired-to-subtree))))))

;; Move and attach files to org headers using dired
(add-hook 'dired-mode-hook
    (lambda ()
      (define-key dired-mode-map (kbd "C-c C-x m")
        (lambda ()
    (interactive)
    (let ((org-attach-method 'mv))
      (call-interactively #'org-attach-dired-to-subtree))))))

TWEAK

;; Have org-attachments add a file name
(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)
;;  Link: [[gnus:nntp+news.gmane.io:gmane.emacs.orgmode#87sg70vsvy.fsf@localhost][Email from Ihor Radchenko: Re: Feature request]]

Return to Home