Revised template functions to include org ID links

This commit is contained in:
Random936 2023-11-24 17:20:40 -08:00
parent b911096899
commit 25b18752e7

View File

@ -1,3 +1,6 @@
:PROPERTIES:
:ID: D6E04450-9FB0-47BD-BE2A-A8BEE3EED201
:END:
#+TITLE: Custom Elisp Functions #+TITLE: Custom Elisp Functions
As of now, I haven't added anything here, though I do expect to start adding some custom functions as I learn more about Elisp. As of now, I haven't added anything here, though I do expect to start adding some custom functions as I learn more about Elisp.
@ -7,19 +10,20 @@ As of now, I haven't added anything here, though I do expect to start adding som
These functions are for my org roam daily capture template. These functions are for my org roam daily capture template.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun jm/get-todos-with-priority (priority files) (defun jm/get-todos-with-priority-helper ()
(let ((items '())) (let ((item-priority (org-entry-get nil "PRIORITY"))
(org-map-entries (item-name (org-entry-get nil "ITEM"))
(lambda () (item-id (car (org-property-values "ID"))))
(when (equal priority (cdr (assoc "PRIORITY" (org-entry-properties)))) (when (and item-id (equal priority item-priority))
(push (cdr (assoc "ITEM" (org-entry-properties))) items))) (format "- [ ] [[id:%s][%s]]" item-id item-name))))
"TODO=\"TODO\""
files)
items))
(defun jm/format-org-todo-items (items) (defun jm/get-todos-with-priority (priority files)
(mapconcat (lambda (item) (concat "- [ ] " item)) (mapconcat #'identity
items (delq nil (org-map-entries
"\n")) #'jm/get-todos-with-priority-helper
"TODO=\"TODO\""
files)) "\n"))
(jm/get-todos-with-priority "A" (org-agenda-files))
#+end_src #+end_src