dotfiles/.emacs.d/functions.org

1.1 KiB

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/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=\"TODO\""
                        files)) "\n"))

(defun jm/daily-todos-dynamic-habits (habit week-days)
  (let ((today (downcase (format-time-string "%a"))))
    (when (seq-contains-p week-days today) habit)))