I take content from nodes of my org-roam database and paste this into e.g. an email. For backtracing the content I would like to have certain information copied to my clipboard to insert it into the mail, too.

I use Doom Emacs and for example, when I press SPC j r i I would like to have this in the clipboard stored: (content from org-roam: <title/headline> [<ID>])

Update: My current attempt is:

(defun lcb/get-roam-id-as-backlink ()
  "get the org-roam id into clipboard"
  (let ((l
         (concat "(org-roam backlink: ["(org-roam-id-at-point)"])"
    (message "stored: %s" l);; feedback in mini buffer
    (kill-new l);; store in clipboard

But I am still missing the part getting also the node’s name.

1 Answer 1


I found a working solution where I get the next heading but not the title of the node:

Answers and ideas are still welcome!

(defun lcb/copy-roam-id-as-backlink ()
  "get the org-roam id into clipboard"
  ;; define a variable to store information based on text and
  ;; dynamic content
  (let ((l (concat "(related org-roam node <"
                   ;; string formats from heading
                   (substring-no-properties  (org-get-heading))
                   ;; get the node ID included, too
                   "> with ID <" (org-roam-id-at-point) ">)"
    ;; send back information about the copied content
    (message (format "stored in clipboard: %s" l))
    ;; store content in the variable in clipboard
    (kill-new l)

To go to node you can copy the node ID from somewhere. Once you call this function you will be directed to the node since the node ID is taken from your clipboard automatically.

;; go to the node with ID (from the clipboard)
(defun lcb/go-to-roam-id ()
  "go to the node with ID"
  ;; getting the ID from the clipboard as plain text
  ;; https://stackoverflow.com/a/12933819/8584652
  (let ((ID (substring-no-properties (car kill-ring))))
    ;; jump to the node with the ID
        (org-id-goto ID)
        ;; display some text in the minibuffer
        (message "welcome to ID <%s>" ID))

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.