dotfiles/.emacs.d/functions.org

974 B

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.

Capture Template Functions

These functions are for my org roam daily capture template.

(defun jm/get-todos-with-priority-helper ()
  (let ((item-priority (org-entry-get nil "PRIORITY"))
        (item-name (org-entry-get nil "ITEM"))
        (item-id (car (org-property-values "ID"))))
    (when (and item-id (equal priority item-priority))
      (format "- [ ] [[id:%s][%s]]" item-id item-name))))

(defun jm/get-todos-with-priority (priority files)
  (mapconcat #'identity
             (delq nil (org-map-entries
                        #'jm/get-todos-with-priority-helper
                        "TODO=\"TODO\""
                        files)) "\n"))

(jm/get-todos-with-priority "A" (org-agenda-files))