aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-27 10:25:16 -0500
committerCraig Jennings <c@cjennings.net>2026-07-27 10:25:16 -0500
commita2d3e77f82ccf5701d9490c1d1fc2d3c75916eae (patch)
treebad261720303b6eefff129de198dd9deddff1abb /tests
parentd5b9b94da207f6e5cffb7a57606f4eadb4823023 (diff)
downloaddotemacs-a2d3e77f82ccf5701d9490c1d1fc2d3c75916eae.tar.gz
dotemacs-a2d3e77f82ccf5701d9490c1d1fc2d3c75916eae.zip
fix: restore Full Agenda controls and clean startupHEADmain
I restored controlled agenda task mutations and filtered completed items from the dedicated frame. I replaced the treesit-auto revision setter that aborted startup with a runtime slot lookup.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-integration-org-agenda-frame-load-order.el15
-rw-r--r--tests/test-org-agenda-frame.el63
-rw-r--r--tests/test-prog-general--pin-go-treesit-revision.el51
3 files changed, 126 insertions, 3 deletions
diff --git a/tests/test-integration-org-agenda-frame-load-order.el b/tests/test-integration-org-agenda-frame-load-order.el
index 6541d250..a8eeaa47 100644
--- a/tests/test-integration-org-agenda-frame-load-order.el
+++ b/tests/test-integration-org-agenda-frame-load-order.el
@@ -23,7 +23,8 @@
;;
;; Validates:
;; - d/w/g/r keep their allowlist commands in the org-first load order
-;; - a real mutation key (t) is still denied (the read-only guarantee holds)
+;; - the controlled status/priority mutations survive the shadow walk
+;; - a non-allowlisted mutation key (t) is still denied
;;
;;; Code:
@@ -65,14 +66,22 @@ Returns an alist of (KEY . BINDING-SYMBOL-NAME-OR-nil)."
(ert-deftest test-integration-org-agenda-frame-allowlist-survives-org-first-load ()
"Integration: with org-agenda loaded before the frame module, the allowlisted
-view/redo keys keep their commands and a mutation key stays denied."
+view/redo and controlled task-mutation keys survive while t stays denied."
(skip-unless (file-exists-p (expand-file-name "modules/org-agenda-frame.el"
test-oaf--repo-root)))
- (let ((got (test-oaf--lookup-in-subprocess '("d" "w" "g" "r" "t"))))
+ (let ((got (test-oaf--lookup-in-subprocess
+ '("d" "w" "g" "r" "C-c t" "C-c C-t"
+ "M-<up>" "M-<right>" "s-<down>" "s-<left>" "t"))))
(should (equal "cj/--agenda-frame-day-view" (cdr (assoc "d" got))))
(should (equal "cj/--agenda-frame-week-view" (cdr (assoc "w" got))))
(should (equal "cj/--agenda-frame-safe-redo" (cdr (assoc "g" got))))
(should (equal "cj/--agenda-frame-safe-redo" (cdr (assoc "r" got))))
+ (should (equal "org-agenda-todo" (cdr (assoc "C-c t" got))))
+ (should (equal "org-agenda-todo" (cdr (assoc "C-c C-t" got))))
+ (should (equal "org-agenda-priority-up" (cdr (assoc "M-<up>" got))))
+ (should (equal "org-agenda-todo-nextset" (cdr (assoc "M-<right>" got))))
+ (should (equal "org-agenda-priority-down" (cdr (assoc "s-<down>" got))))
+ (should (equal "org-agenda-todo-previousset" (cdr (assoc "s-<left>" got))))
;; t is a real org mutation key; it must be denied, not allowlisted.
(should (equal "cj/--agenda-frame-denied-readonly" (cdr (assoc "t" got))))))
diff --git a/tests/test-org-agenda-frame.el b/tests/test-org-agenda-frame.el
index 3c56d361..167cf2ff 100644
--- a/tests/test-org-agenda-frame.el
+++ b/tests/test-org-agenda-frame.el
@@ -174,6 +174,45 @@ leaves a wide blank gutter between the source name and the item."
(should (string-match-p "%-10:c"
(cadr (assq 'org-agenda-prefix-format s))))))
+(ert-deftest test-org-agenda-frame-command-skips-done-items ()
+ "Normal: completed tasks never appear in the Full Agenda.
+The global agenda deliberately shows scheduled done items, so the dedicated
+view needs its own skip function to exclude every done-state keyword."
+ (let* ((settings (test-org-agenda-frame--block-settings))
+ (skip (assq 'org-agenda-skip-function settings)))
+ (should skip)
+ (should (equal (eval (cadr skip) t)
+ '(org-agenda-skip-entry-if 'todo 'done)))))
+
+(ert-deftest test-org-agenda-frame-command-render-excludes-scheduled-done ()
+ "Boundary: a scheduled high-priority DONE item is absent from rendered output.
+An equally scheduled active task remains, proving the whole date was not
+skipped."
+ (require 'org-agenda)
+ (let* ((file (make-temp-file "agenda-frame-done-" nil ".org"))
+ (today (format-time-string "%Y-%m-%d %a"))
+ (org-agenda-files (list file))
+ (org-agenda-custom-commands (list (cj/--agenda-frame-command)))
+ (org-agenda-sticky nil)
+ (agenda-buffer "*Org Agenda*"))
+ (unwind-protect
+ (progn
+ (with-temp-file file
+ (insert "#+TODO: TODO | DONE\n"
+ "* DONE [#A] completed-scheduled-marker\n"
+ "SCHEDULED: <" today ">\n"
+ "* TODO [#A] active-scheduled-marker\n"
+ "SCHEDULED: <" today ">\n"))
+ (org-agenda nil cj/--agenda-frame-command-key)
+ (with-current-buffer agenda-buffer
+ (should-not (string-match-p "completed-scheduled-marker"
+ (buffer-string)))
+ (should (string-match-p "active-scheduled-marker"
+ (buffer-string)))))
+ (when (get-buffer agenda-buffer)
+ (kill-buffer agenda-buffer))
+ (delete-file file))))
+
(ert-deftest test-org-agenda-frame-do-redo-leaves-sticky-alone ()
"Normal: the redo binds current-window but never touches sticky.
org-agenda-redo handles the in-place rebuild itself (it binds sticky nil
@@ -315,6 +354,24 @@ d shrinks the frame to the current day, w restores the seven-day span."
(should (eq (lookup-key cj/agenda-frame-mode-map (kbd "w"))
'cj/--agenda-frame-week-view)))
+(ert-deftest test-org-agenda-frame-map-controlled-task-mutations ()
+ "Normal: status and priority changes are the frame's controlled mutations.
+C-c t is Craig's requested status chord, C-c C-t keeps Org's standard agenda
+chord, and both Meta and the configured Super arrows support the same
+priority/status operations."
+ (dolist (binding '(("C-c t" . org-agenda-todo)
+ ("C-c C-t" . org-agenda-todo)
+ ("M-<up>" . org-agenda-priority-up)
+ ("M-<down>" . org-agenda-priority-down)
+ ("M-<left>" . org-agenda-todo-previousset)
+ ("M-<right>" . org-agenda-todo-nextset)
+ ("s-<up>" . org-agenda-priority-up)
+ ("s-<down>" . org-agenda-priority-down)
+ ("s-<left>" . org-agenda-todo-previousset)
+ ("s-<right>" . org-agenda-todo-nextset)))
+ (should (eq (lookup-key cj/agenda-frame-mode-map (kbd (car binding)))
+ (cdr binding)))))
+
(ert-deftest test-org-agenda-frame-shadow-denies-org-mutations-preserves-allowlist ()
"Boundary: with the frame mode active over `org-agenda-mode-map', mutating
org-agenda keys are denied and the allowlist still works.
@@ -340,6 +397,12 @@ d/w, C-c C-o) intact."
(should (eq (key-binding (kbd "g")) 'cj/--agenda-frame-safe-redo))
(should (eq (key-binding (kbd "d")) 'cj/--agenda-frame-day-view))
(should (eq (key-binding (kbd "w")) 'cj/--agenda-frame-week-view))
+ (should (eq (key-binding (kbd "C-c t")) 'org-agenda-todo))
+ (should (eq (key-binding (kbd "C-c C-t")) 'org-agenda-todo))
+ (should (eq (key-binding (kbd "M-<up>")) 'org-agenda-priority-up))
+ (should (eq (key-binding (kbd "M-<right>")) 'org-agenda-todo-nextset))
+ (should (eq (key-binding (kbd "s-<down>")) 'org-agenda-priority-down))
+ (should (eq (key-binding (kbd "s-<left>")) 'org-agenda-todo-previousset))
(should (eq (key-binding (kbd "C-c C-o")) 'cj/--agenda-frame-open-link))
(should (eq (key-binding (kbd "q")) 'cj/--agenda-frame-close))))
diff --git a/tests/test-prog-general--pin-go-treesit-revision.el b/tests/test-prog-general--pin-go-treesit-revision.el
new file mode 100644
index 00000000..42845b4f
--- /dev/null
+++ b/tests/test-prog-general--pin-go-treesit-revision.el
@@ -0,0 +1,51 @@
+;;; test-prog-general--pin-go-treesit-revision.el --- Go grammar pinning -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; The treesit-auto Go recipe is pinned for compatibility with Emacs 30.2.
+;; Keep the mutation independent of cl-defstruct's compile-time setter
+;; expansion: prog-general is loaded before treesit-auto defines that setter
+;; during a normal startup.
+
+;;; Code:
+
+(require 'ert)
+(require 'cl-lib)
+
+;; Deliberately put `revision' at a different offset from treesit-auto's real
+;; struct. The production helper must discover the slot rather than hard-code
+;; the package's current vector layout.
+(cl-defstruct treesit-auto-recipe lang revision url)
+
+(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
+(require 'prog-general)
+
+(ert-deftest test-prog-general-pin-go-treesit-revision-updates-go ()
+ "Normal: the Go recipe receives the supported grammar revision."
+ (let* ((go (make-treesit-auto-recipe
+ :lang 'go :revision "main" :url "https://example.test/go"))
+ (python (make-treesit-auto-recipe
+ :lang 'python :revision "main"
+ :url "https://example.test/python")))
+ (cj/treesit-auto-pin-go-revision (list python go))
+ (should (equal (treesit-auto-recipe-revision go) "v0.19.1"))
+ (should (equal (treesit-auto-recipe-revision python) "main"))))
+
+(ert-deftest test-prog-general-pin-go-treesit-revision-no-go-is-no-op ()
+ "Boundary: a recipe list without Go remains unchanged."
+ (let ((python (make-treesit-auto-recipe
+ :lang 'python :revision "main"
+ :url "https://example.test/python")))
+ (should-not (cj/treesit-auto-pin-go-revision (list python)))
+ (should (equal (treesit-auto-recipe-revision python) "main"))))
+
+(ert-deftest test-prog-general-pin-go-treesit-revision-empty-is-no-op ()
+ "Boundary: an empty recipe list does not signal an error."
+ (should-not (cj/treesit-auto-pin-go-revision nil)))
+
+(ert-deftest test-prog-general-pin-go-treesit-revision-malformed-recipe-errors ()
+ "Error: a malformed recipe signals instead of silently skipping the pin."
+ (should-error (cj/treesit-auto-pin-go-revision '(not-a-recipe))
+ :type 'wrong-type-argument))
+
+(provide 'test-prog-general--pin-go-treesit-revision)
+;;; test-prog-general--pin-go-treesit-revision.el ends here