I often need to open attachments associated with a node. I used first
navigate to the node and then perform an opening of an attachment.
Now, with the following command, I can open attachments when I am
navigating from the node selection in Helm
.
1
2
| (defun chatgpt/add-slash-to-string (str)
(concat (substring str 0 2) "/" (substring str 2)))
|
1
2
3
4
5
6
7
8
| ("[C-c C-o ] Open attachment" . (lambda (canadidate)
(let* ((note-id (org-roam-node-from-id (nth 0 canadidate)))
(attach-dir (expand-file-name
(chatgpt/add-slash-to-string (org-roam-node-id note-id))
org-attach-directory)))
(if (file-exists-p attach-dir)
(dired attach-dir)
(message "Attachment directory not found.")))))
|