diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/org-agenda-frame.el | 43 | ||||
| -rw-r--r-- | modules/prog-general.el | 27 |
2 files changed, 53 insertions, 17 deletions
diff --git a/modules/org-agenda-frame.el b/modules/org-agenda-frame.el index f0de99ce..471b246b 100644 --- a/modules/org-agenda-frame.el +++ b/modules/org-agenda-frame.el @@ -42,6 +42,11 @@ (declare-function org-agenda-next-item "org-agenda" (n)) (declare-function org-agenda-previous-item "org-agenda" (n)) (declare-function org-agenda-open-link "org-agenda" (&optional arg)) +(declare-function org-agenda-priority-down "org-agenda" ()) +(declare-function org-agenda-priority-up "org-agenda" ()) +(declare-function org-agenda-todo "org-agenda" (&optional arg)) +(declare-function org-agenda-todo-nextset "org-agenda" ()) +(declare-function org-agenda-todo-previousset "org-agenda" ()) (declare-function org-get-at-bol "org" (property)) (declare-function org-fold-show-context "org-fold" (&optional key)) (declare-function org-agenda "org-agenda" (&optional arg org-keys restriction)) @@ -121,6 +126,11 @@ a non-nil global default can't open a second window at build time." (org-agenda-start-day "0d") (org-agenda-start-on-weekday nil) (org-agenda-start-with-follow-mode nil) + ;; The global daily agenda intentionally keeps scheduled done + ;; items visible. The Full Agenda is a live work surface, so + ;; completed items are noise regardless of schedule or priority. + (org-agenda-skip-function + '(org-agenda-skip-entry-if 'todo 'done)) ;; Narrow category column: the global agenda format pads the ;; category to 25 chars, leaving a wide blank gutter between ;; the source name (todo:, dcal:) and the item. @@ -273,6 +283,22 @@ The default binding for every key not on the allowlist." ;; other view-changers stay denied to keep the today-anchored frame stable. (define-key map (kbd "d") #'cj/--agenda-frame-day-view) (define-key map (kbd "w") #'cj/--agenda-frame-week-view) + ;; (d) Controlled task mutations. The frame remains default-deny for + ;; scheduling, clocking, capture, notes, and file writes, but status and + ;; priority are deliberate in-place agenda operations. C-c t is Craig's + ;; requested status chord; C-c C-t keeps Org's standard agenda chord. + ;; This config uses Super arrows in ordinary Org agendas, while Meta arrows + ;; are the requested Full Agenda muscle memory, so support both. + (define-key map (kbd "C-c t") #'org-agenda-todo) + (define-key map (kbd "C-c C-t") #'org-agenda-todo) + (dolist (key '("M-<up>" "s-<up>")) + (define-key map (kbd key) #'org-agenda-priority-up)) + (dolist (key '("M-<down>" "s-<down>")) + (define-key map (kbd key) #'org-agenda-priority-down)) + (dolist (key '("M-<left>" "s-<left>")) + (define-key map (kbd key) #'org-agenda-todo-previousset)) + (dolist (key '("M-<right>" "s-<right>")) + (define-key map (kbd key) #'org-agenda-todo-nextset)) (define-key map (kbd "S-<f8>") #'cj/agenda-frame-toggle) (define-key map (kbd "C-M-<f8>") #'cj/org-agenda-refresh-files) ;; C-x C-c means "close this frame" here. The global @@ -280,7 +306,7 @@ The default binding for every key not on the allowlist." ;; by `make-frame', not emacsclient, so with no client to close it falls ;; back to killing the daemon itself. (define-key map (kbd "C-x C-c") #'cj/--agenda-frame-close) - ;; (d) Input machinery punched through the catch-all. An explicit nil + ;; (e) Input machinery punched through the catch-all. An explicit nil ;; shadows the [t] default in this map, so these fall through to their ;; global bindings. Without the punches, every frame-focus change ;; (switch-frame), every wheel scroll, and every mouse click hits the @@ -292,7 +318,7 @@ The default binding for every key not on the allowlist." [mouse-1] [down-mouse-1] [drag-mouse-1] (kbd "C-h"))) (define-key map key nil)) - ;; (e) Global chords that would pull focus out of the frame must be + ;; (f) Global chords that would pull focus out of the frame must be ;; denied *explicitly*. The [t] catch-all can't reach them: a keymap's ;; default binding does not shadow an *explicit* binding in a ;; lower-priority map, and these are bound in the global map (M-SPC / @@ -307,16 +333,17 @@ The default binding for every key not on the allowlist." map) "Keymap for `cj/agenda-frame-mode'. Shadows `org-agenda-mode-map' by default-deny: the `[t]' catch-all denies -every key that is not explicitly allowlisted here, so a future Org binding -is denied by default and there is nothing to keep in sync.") +every key that is not explicitly allowlisted here. Status and priority are +the only source-task mutations allowed; a future Org binding is denied by +default and there is nothing to keep in sync.") (define-minor-mode cj/agenda-frame-mode - "Read-only, focus-locked policy for the dedicated agenda frame. + "Focus-locked, default-deny policy for the dedicated agenda frame. Only the allowlist in `cj/agenda-frame-mode-map' is permitted: navigation, the engage/open keys (routed to the working frame), and the frame's own -controls. Every other key/mouse command is denied. The enforcement -boundary is keys and mouse; a direct \\[execute-extended-command] is out -of contract." +controls, plus controlled task status and priority changes. Every other +key/mouse command is denied. The enforcement boundary is keys and mouse; +a direct \\[execute-extended-command] is out of contract." :init-value nil :lighter " AgendaFrame" :keymap cj/agenda-frame-mode-map) diff --git a/modules/prog-general.el b/modules/prog-general.el index a1377160..77ff88a5 100644 --- a/modules/prog-general.el +++ b/modules/prog-general.el @@ -39,6 +39,7 @@ ;;; Code: (require 'user-constants) ;; code-dir, projects-dir, snippets-dir +(require 'cl-lib) (defvar display-line-numbers-type) (defvar outline-minor-mode-map) @@ -57,6 +58,7 @@ (declare-function dired-get-filename "dired") (declare-function global-treesit-auto-mode "treesit-auto") (declare-function treesit-auto-add-to-auto-mode-alist "treesit-auto") +(declare-function treesit-auto-install-all "treesit-auto") (declare-function treesit-auto-recipe-lang "treesit-auto") (declare-function highlight-indent-guides-mode "highlight-indent-guides") (declare-function electric-pair-default-inhibit "elec-pair") @@ -120,20 +122,27 @@ REGEXP must be a string or an rx form." ;; build mid-edit. Batch/test runs never load treesit-auto (no package ;; init), so they can never install. Fresh-machine bootstrap is the ;; explicit `cj/install-treesit-grammars' command below. +(defun cj/treesit-auto-pin-go-revision (recipes) + "Pin the Go grammar revision in treesit-auto RECIPES. +Return the updated Go recipe, or nil when RECIPES has no Go entry. +Discover the `revision' slot at runtime because treesit-auto is not loaded +when this file's `use-package' form is macro-expanded." + (when-let ((go-recipe + (cl-find-if + (lambda (recipe) + (eq (treesit-auto-recipe-lang recipe) 'go)) + recipes))) + (aset go-recipe + (cl-struct-slot-offset 'treesit-auto-recipe 'revision) + "v0.19.1") + go-recipe)) + (use-package treesit-auto :custom (treesit-auto-install 'prompt) :config - (require 'cl-lib) ;; Pin Go grammar to v0.19.1 for compatibility with Emacs 30.2 font-lock queries - (let* ((go-idx (cl-position-if (lambda (recipe) - (eq (treesit-auto-recipe-lang recipe) 'go)) - treesit-auto-recipe-list)) - (go-recipe (and go-idx (nth go-idx treesit-auto-recipe-list)))) - (when go-recipe - ;; Use the struct accessor so a treesit-auto slot reorder can't silently - ;; write the pin into the wrong field. - (setf (treesit-auto-recipe-revision go-recipe) "v0.19.1"))) + (cj/treesit-auto-pin-go-revision treesit-auto-recipe-list) (treesit-auto-add-to-auto-mode-alist 'all) (global-treesit-auto-mode)) |
