#+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.

* Capture Template Functions

These functions are for my org roam daily capture template. 

#+begin_src emacs-lisp
(defun jm/daily-todos-priority-tasks-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/daily-todos-get-priority-tasks (priority files)
  (mapconcat #'identity
             (delq nil (org-map-entries
                        #'jm/daily-todos-priority-tasks-helper
                        "TODO=\"IN PROGRESS\""
                        files)) "\n"))

(defun jm/daily-todos-dynamic-habits (habit week-days)
  (let* ((org-date (or (org-capture-get :default-time) (current-time)))
         (today (downcase (format-time-string "%a" org-date))))
    (when (seq-contains-p week-days today) habit)))
#+end_src

