50 lines
3.6 KiB
EmacsLisp
50 lines
3.6 KiB
EmacsLisp
#s(ellama-session "Function compatibility (Open AI)" #s(llm-openai "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" "gpt-4" "text-embedding-3-large") "/home/amr/org/ellama-sessions/Function compatibility (Open AI).org" #s(llm-chat-prompt nil nil (#s(llm-chat-prompt-interaction system "" nil) #s(llm-chat-prompt-interaction user "Will this function work with the following CREATED property: :CREATED: [2009-07-27 Mon 17:12]" nil) #s(llm-chat-prompt-interaction assistant "As an AI, I need more context in order to answer accurately. If you refer to a function in programming, you would need to specify the programming language and the structure of the function, so I could determine whether the date property could be passed into it correctly.
|
|
For instance, in the Emacs Organizer mode (often used for note-taking, maintaining TODO lists, project planning, and authoring), the :CREATED: property would commonly be used for timestamps. We would need to know the specific function you're asking about to determine its compatibility with this property.
|
|
|
|
If you're referring to a function in a different context (like math, for example), then the concept of a :CREATED: property would not typically be applicable." nil) #s(llm-chat-prompt-interaction user "here is the function: (defun my/org-refile-header-to-org-roam-dailies-by-created-date ()
|
|
\"Move the current org header to the corresponding org-roam-dailies file based on its :CREATED:
|
|
property.\"
|
|
(interactive)
|
|
(unless (org-at-heading-p)
|
|
(error \"Not at an org heading\"))
|
|
(let* (
|
|
; Get the CREATED property at point and parse it to the proper datetree format
|
|
(created (org-entry-get (point) \"CREATED\"))
|
|
; Extract the date and ignore the time
|
|
(date-string (when created
|
|
(nth 0 (split-string created \" \"))
|
|
)
|
|
)
|
|
; Convert the string to a date
|
|
(date (and date-string
|
|
(org-read-date nil t date-string))
|
|
)
|
|
)
|
|
(when date
|
|
(save-excursion
|
|
(org-cut-subtree)
|
|
(org-roam-dailies-find-date date)
|
|
(goto-char (point-max))
|
|
(newline)
|
|
(org-paste-subtree)
|
|
(save-buffer)
|
|
)
|
|
)
|
|
)
|
|
(message \"Date string: %s, Date: %s\" date-string date)
|
|
;; (message \"Moved header to the corresponding org-roam-dailies file.\")
|
|
)" nil) #s(llm-chat-prompt-interaction assistant "This function is written in Emacs Lisp (Elisp) and it's designed to refile headers in Emacs' Org-mode based on the :CREATED: property.
|
|
|
|
The :CREATED: property you provided earlier, :CREATED: [2009-07-27 Mon 17:12] is a right format that can be used with this function.
|
|
|
|
This Elisp function does the following:
|
|
|
|
1. Check if the point (cursor) is at an Org-mode heading.
|
|
2. Retrieve the value of the :CREATED: property of the current heading.
|
|
3. Process this value to extract the date (ignoring the time).
|
|
4. Use this date to find the correct org-roam-dailies file.
|
|
5. Cut the current subtree (the heading and its contents) and paste it into the org-roam-dailies file at the correct date.
|
|
6. Save the org-roam-dailies file.
|
|
7. Output a message indicating the date string and the formatted date.
|
|
|
|
So in short, yes, the function should work with your :CREATED: property. Ensure org-roam and org-roam-dailies are properly installed and configured, since the function relies on them." nil)) nil nil nil) nil) |