Load full tangled org-config for container
- Set imalison:org-dir and imalison:shared-org-dir for container paths - Load org-config-preface.el, org-config-custom.el, org-config-config.el - This properly sets org-agenda-files and org-agenda-custom-commands - Add capture templates for API Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
6
nixos/flake.lock
generated
6
nixos/flake.lock
generated
@@ -1756,11 +1756,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1768386240,
|
"lastModified": 1768413426,
|
||||||
"narHash": "sha256-ayb/sZDS7wO3YWM7JoJZ6mOPJhyzgCpIQ5ooiYUfRuM=",
|
"narHash": "sha256-JqIQYMO3a0J7UPS7edXie8fVrSMX+mMZKJjyGvNbZeE=",
|
||||||
"owner": "colonelpanic8",
|
"owner": "colonelpanic8",
|
||||||
"repo": "org-agenda-api",
|
"repo": "org-agenda-api",
|
||||||
"rev": "3c84b0875e425ab46e2576c4a5d5d990ebff2d07",
|
"rev": "f342ee0b73ccd48a7aff12ca07bd742a96c1776e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -335,7 +335,7 @@
|
|||||||
# Path to org-config.org in the dotfiles
|
# Path to org-config.org in the dotfiles
|
||||||
orgConfigOrg = ../dotfiles/emacs.d/org-config.org;
|
orgConfigOrg = ../dotfiles/emacs.d/org-config.org;
|
||||||
|
|
||||||
# Tangle org-config.org and convert to setq format
|
# Tangle org-config.org and create a loader for the container
|
||||||
orgAgendaCustomConfig = pkgs.runCommand "org-agenda-custom-config" {
|
orgAgendaCustomConfig = pkgs.runCommand "org-agenda-custom-config" {
|
||||||
buildInputs = [ pkgs.emacs-nox ];
|
buildInputs = [ pkgs.emacs-nox ];
|
||||||
} ''
|
} ''
|
||||||
@@ -350,62 +350,56 @@
|
|||||||
--eval '(require (quote org))' \
|
--eval '(require (quote org))' \
|
||||||
--eval '(org-babel-tangle-file "work/org-config.org")'
|
--eval '(org-babel-tangle-file "work/org-config.org")'
|
||||||
|
|
||||||
if [ -f "work/org-config-custom.el" ]; then
|
# Copy all tangled files to output
|
||||||
# Use emacs to properly parse and convert s-expressions to setq
|
for f in work/org-config-*.el; do
|
||||||
emacs --batch \
|
if [ -f "$f" ]; then
|
||||||
--eval "(with-temp-buffer
|
cp "$f" $out/
|
||||||
(insert-file-contents \"work/org-config-custom.el\")
|
|
||||||
(goto-char (point-min))
|
|
||||||
(let ((forms nil))
|
|
||||||
(condition-case nil
|
|
||||||
(while t
|
|
||||||
(let ((form (read (current-buffer))))
|
|
||||||
(when (and (listp form) (symbolp (car form)))
|
|
||||||
(push (list 'setq (car form) (cadr form)) forms))))
|
|
||||||
(end-of-file nil))
|
|
||||||
(with-temp-file \"$out/custom-config.el\"
|
|
||||||
(dolist (form (nreverse forms))
|
|
||||||
(prin1 form (current-buffer))
|
|
||||||
(insert \"\n\")))))"
|
|
||||||
else
|
|
||||||
echo "Warning: org-config-custom.el not found after tangle"
|
|
||||||
touch $out/custom-config.el
|
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Append custom agenda commands and capture templates for the API
|
# Create a loader that sets up paths and loads files in order
|
||||||
cat >> $out/custom-config.el << 'ELISP'
|
cat > $out/custom-config.el << 'ELISP'
|
||||||
|
;;; custom-config.el --- Container config loader -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Custom agenda commands for API
|
;; Set org directory for container
|
||||||
(setq org-agenda-custom-commands
|
(defvar imalison:org-dir "/data/org")
|
||||||
'(("n" "Next actions" todo "NEXT")
|
(defvar imalison:shared-org-dir "/data/org/katnivan")
|
||||||
("s" "Started tasks" todo "STARTED")
|
|
||||||
("i" "Inbox" todo "INBOX")
|
;; Helper function used by org-config
|
||||||
("w" "Waiting tasks" todo "WAIT")
|
(defun imalison:join-paths (&rest paths)
|
||||||
("h" "High priority" tags-todo "+PRIORITY<\"C\"")
|
"Join PATHS together into a single path."
|
||||||
("M" "Main view"
|
(let ((result (car paths)))
|
||||||
((agenda "" ((org-agenda-span 5)))
|
(dolist (p (cdr paths))
|
||||||
(todo "NEXT")
|
(setq result (expand-file-name p result)))
|
||||||
(todo "STARTED")
|
result))
|
||||||
(todo "INBOX")))))
|
|
||||||
|
;; Load tangled config files in order
|
||||||
|
(let ((config-dir (file-name-directory load-file-name)))
|
||||||
|
(when (file-exists-p (expand-file-name "org-config-preface.el" config-dir))
|
||||||
|
(load (expand-file-name "org-config-preface.el" config-dir)))
|
||||||
|
(when (file-exists-p (expand-file-name "org-config-custom.el" config-dir))
|
||||||
|
(load (expand-file-name "org-config-custom.el" config-dir)))
|
||||||
|
(when (file-exists-p (expand-file-name "org-config-config.el" config-dir))
|
||||||
|
(load (expand-file-name "org-config-config.el" config-dir))))
|
||||||
|
|
||||||
;; Capture templates for API
|
;; Capture templates for API
|
||||||
(setq org-agenda-api-capture-templates
|
(setq org-agenda-api-capture-templates
|
||||||
'(("gtd-todo"
|
`(("gtd-todo"
|
||||||
:name "GTD Todo"
|
:name "GTD Todo"
|
||||||
:template ("t" "Todo" entry (file "/data/org/inbox.org")
|
:template ("t" "Todo" entry (file ,(imalison:join-paths imalison:org-dir "inbox.org"))
|
||||||
"* INBOX %^{Title}\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
|
"* INBOX %^{Title}\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
|
||||||
:immediate-finish t)
|
:immediate-finish t)
|
||||||
:prompts (("Title" :type string :required t)))
|
:prompts (("Title" :type string :required t)))
|
||||||
("scheduled-todo"
|
("scheduled-todo"
|
||||||
:name "Scheduled Todo"
|
:name "Scheduled Todo"
|
||||||
:template ("s" "Scheduled" entry (file "/data/org/inbox.org")
|
:template ("s" "Scheduled" entry (file ,(imalison:join-paths imalison:org-dir "inbox.org"))
|
||||||
"* INBOX %^{Title}\nSCHEDULED: %^{When}t\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
|
"* INBOX %^{Title}\nSCHEDULED: %^{When}t\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
|
||||||
:immediate-finish t)
|
:immediate-finish t)
|
||||||
:prompts (("Title" :type string :required t)
|
:prompts (("Title" :type string :required t)
|
||||||
("When" :type date :required t)))
|
("When" :type date :required t)))
|
||||||
("deadline-todo"
|
("deadline-todo"
|
||||||
:name "Todo with Deadline"
|
:name "Todo with Deadline"
|
||||||
:template ("d" "Deadline" entry (file "/data/org/inbox.org")
|
:template ("d" "Deadline" entry (file ,(imalison:join-paths imalison:org-dir "inbox.org"))
|
||||||
"* INBOX %^{Title}\nDEADLINE: %^{When}t\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
|
"* INBOX %^{Title}\nDEADLINE: %^{When}t\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
|
||||||
:immediate-finish t)
|
:immediate-finish t)
|
||||||
:prompts (("Title" :type string :required t)
|
:prompts (("Title" :type string :required t)
|
||||||
|
|||||||
Reference in New Issue
Block a user