#s(ellama-session "Emacs function for org-mode (Open AI)" #s(llm-openai "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" "gpt-4" "text-embedding-3-large") "/home/amr/org/ellama-sessions/Emacs function for org-mode (Open AI).org" #s(llm-chat-prompt nil nil (#s(llm-chat-prompt-interaction system "" nil) #s(llm-chat-prompt-interaction user "Write an emacs function that takes an org header with a property :CREATED: [2009-07-27 Mon 17:12] and moves the header to an org-roam-dailies node with the same date 2009-07-27" nil) #s(llm-chat-prompt-interaction assistant "Here's a basic Emacs Lisp function named `move-org-header-to-daily-node` you could use as a starting point. The function first extracts the `:CREATED:` property from the current org mode header, then navigates to a file with the same date under your org-roam-dailies directory, and finally moves the selected subtree to that file. ```lisp (defun move-org-header-to-daily-node () \"Find an org header's :CREATED: property and move it to an org-roam-dailies node with the same date.\" (interactive) (let* ((created-prop (org-entry-get nil \"CREATED\")) (date (when created-prop (substring created-prop 1 11))) (org-roam-dir (file-truename (expand-file-name \"~/org-roam-dir\"))) ;; replace with your actual org-roam directory (daily-file-path (concat org-roam-dir \"/daily/\" date \".org\"))) (if (and created-prop date (file-exists-p daily-file-path)) (progn (org-cut-subtree) (find-file daily-file-path) (goto-char (point-max)) (org-paste-subtree)) (error \"Cannot move header because :CREATED: property or corresponding org-roam-dailies file is missing\")))) ``` This function assumes that you're at the header you want to move when you call it, and it can't handle situations where the `:CREATED:` property is missing or malformed, or if the corresponding date's file doesn't exist in the org-roam-dailies directory. You will need to replace `\"~/org-roam-dir\"` with your actual org-roam directory. Remember that custom Lisp functions can be bound to a key in your Emacs configuration so you easily can call them whenever you want without having to type `M-x` and the function name every time. In a real-world usage case, tweaking this function or writing other functions to add error handling and to create the missing dailies nodes would likely be a good idea." nil)) nil nil nil) nil)