diff options
| author | 2026-06-29 13:58:20 -0700 | |
|---|---|---|
| committer | 2026-06-29 13:58:20 -0700 | |
| commit | 2d535f26420dedaa225ee2c0ae1de64793db3df4 (patch) | |
| tree | 6b7e264516fc171fa404c09e847505095dcec38d | |
| parent | 2699c85fa5202ed9f59d3b9165e0b535b9bf0c0b (diff) | |
| download | emacs-config-2d535f26420dedaa225ee2c0ae1de64793db3df4.tar.gz emacs-config-2d535f26420dedaa225ee2c0ae1de64793db3df4.zip | |
oni-org: Replace ‘oni-org--map-put’ with ‘map-put!’
| -rw-r--r-- | oni-org/oni-org.el | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index ea85dbc..abe851b 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse <tom@ryuslash.org> ;; Keywords: local -;; Version: 2026.0616.072304 +;; Version: 2026.0629.135805 ;; Package-Requires: (oni-hydra org org-edna diminish olivetti org-pretty-table) ;; This program is free software; you can redistribute it and/or modify @@ -454,7 +454,7 @@ and not a state update." ;;;;; Custom Commands -(oni-org--map-put org-agenda-custom-commands "n" +(map-put! org-agenda-custom-commands "n" '("NEXT items" ((todo "NEXT")))) @@ -986,26 +986,8 @@ This is done by adding a ‘:hidden t’ header argument to the code block." ,(/ (length text) 2))))) text)) -(defmacro oni-org--map-put (collection key value) - "The result of ‘(setf (map-elt ...) ...)’ on a list. -Trying to byte-compile the above form doesn't work at the moment. -This is a temporary hack to make sure I don't have to repeat this -same code all the time." - (declare (indent 2)) - (let ((key-name (gensym)) - (value-name (gensym))) - `(let ((,key-name ,key) - (,value-name ,value)) - (condition-case nil - (with-no-warnings - (map-put! ,collection ,key-name ,value-name nil)) - (map-not-inplace - (setq ,collection - (map-insert ,collection ,key-name ,value-name)) - ,value-name))))) - (defvar oni-org--capture-D-date nil) -(oni-org--map-put org-capture-templates "D" +(map-put! org-capture-templates "D" '("A DONE item for my to-done list." entry (file oni-org-todo-main-file) "* DONE %? CLOSED: %(setq oni-org--capture-D-date (format-time-string (org-time-stamp-format t t) (org-read-date t t nil \"Date: \"))) :PROPERTIES: @@ -1016,13 +998,13 @@ CLOSED: %(setq oni-org--capture-D-date (format-time-string (org-time-stamp-forma :END:" :after-finalize (lambda () (setq oni-org--capture-D-date nil)))) -(oni-org--map-put org-capture-templates "t" +(map-put! org-capture-templates "t" '("A simple TODO item." entry (file "") "* TODO %? :PROPERTIES: :CREATED: %U :END:")) -(oni-org--map-put org-capture-templates "U" +(map-put! org-capture-templates "U" '("A TODO capture from the browser." entry (file "") "* TODO %:description :PROPERTIES: :CREATED: %U @@ -1044,7 +1026,7 @@ CLOSED: %(setq oni-org--capture-D-date (format-time-string (org-time-stamp-forma oni-org-todo-dir)) (setq-local oni-org--capture-page-title title))) -(oni-org--map-put org-capture-templates "p" +(map-put! org-capture-templates "p" '("A note page." plain (function oni-org-find-new-note-file) "#+TITLE: %(with-current-buffer (org-capture-get :buffer) oni-org--capture-page-title) #+DATE: %U @@ -1053,10 +1035,10 @@ CLOSED: %(setq oni-org--capture-D-date (format-time-string (org-time-stamp-forma (delete-file (buffer-file-name (org-capture-get :buffer)) t) (kill-buffer (org-capture-get :buffer)))))) -(oni-org--map-put org-capture-templates "c" +(map-put! org-capture-templates "c" '("Chores")) -(oni-org--map-put org-capture-templates "cl" +(map-put! org-capture-templates "cl" `("Laundry" entry (file ,oni-org-todo-main-file) (file ,(expand-file-name "laundry.org" oni-org-capture-template-directory)) :immediate-finish t)) @@ -1075,7 +1057,7 @@ CLOSED: %(setq oni-org--capture-D-date (format-time-string (org-time-stamp-forma (expand-file-name "morning-checklist-trash.org" oni-org-capture-template-directory))) template)))) -(oni-org--map-put org-capture-templates "cm" +(map-put! org-capture-templates "cm" `("Morning Checklist" entry (file ,oni-org-todo-main-file) (function oni-org-get-morning-checklist) :immediate-finish t)) |
