aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-12 02:28:43 -0500
committerCraig Jennings <c@cjennings.net>2026-06-12 02:28:43 -0500
commit1dba35cc182691390d80c789502b174292b14777 (patch)
tree1c31b633f2d517d9349c5871a401879e667f96e3
parent22e19c21e6aabe0319d4b09a862f4a3705c92509 (diff)
downloadrulesets-1dba35cc182691390d80c789502b174292b14777.tar.gz
rulesets-1dba35cc182691390d80c789502b174292b14777.zip
fix(scripts): lint-org pre-registers runtime org link types
mu4e registers its link type in a live Emacs, so batch org-lint parsed [[mu4e:msgid:...]] links as fuzzy heading refs and flagged "Unknown fuzzy location" on links that work interactively. lint-org now registers each type in lo-runtime-link-types as a no-op before linting. org-link-set-parameters merges rather than replaces, so a genuinely loaded mu4e keeps its real parameters.
-rw-r--r--.ai/scripts/lint-org.el19
-rw-r--r--.ai/scripts/tests/test-lint-org.el18
-rw-r--r--claude-templates/.ai/scripts/lint-org.el19
-rw-r--r--claude-templates/.ai/scripts/tests/test-lint-org.el18
4 files changed, 74 insertions, 0 deletions
diff --git a/.ai/scripts/lint-org.el b/.ai/scripts/lint-org.el
index 05365fe..8f55cc6 100644
--- a/.ai/scripts/lint-org.el
+++ b/.ai/scripts/lint-org.el
@@ -70,6 +70,24 @@ path as an org section dated today. The file is created if missing.")
'(item-number missing-language-in-src-block misplaced-planning-info)
"org-lint checker names that are always treated as mechanical.")
+(defvar lo-runtime-link-types '("mu4e")
+ "Org link types registered by packages at runtime in a live Emacs.
+In batch, org doesn't know these types, so org-lint parses
+=[[mu4e:msgid:...]]= as a fuzzy heading ref and reports a false
+invalid-fuzzy-link (\"Unknown fuzzy location\"). Each type listed here is
+registered as a no-op via `org-link-set-parameters' before linting, so the
+link parses as a link. Add a type when a live-Emacs-only link package's
+links start false-flagging in batch runs.")
+
+(defun lo--register-runtime-link-types ()
+ "Register each of `lo-runtime-link-types' so batch org-lint parses them.
+Idempotent: re-registering an already-known type is harmless, and a type
+the running Emacs genuinely provides (e.g. linting interactively with mu4e
+loaded) keeps its real parameters because `org-link-set-parameters' merges
+rather than replaces."
+ (dolist (type lo-runtime-link-types)
+ (org-link-set-parameters type)))
+
;; misplaced-heading is split case-by-case in `lo--handle-item': markdown-bold
;; is auto-fixed, verbatim-asterisk is suppressed as a false positive, anything
;; else is surfaced as judgment.
@@ -365,6 +383,7 @@ Emits one judgment item per violating table."
Resets `lo-fixes' and `lo-issues' for each call. In --check mode the file is
left unmodified and mechanical entries are recorded with :preview t."
(setq lo-current-file file lo-fixes 0 lo-issues nil)
+ (lo--register-runtime-link-types)
(unless lo-check-only
(lo--backup file))
(let ((buf (find-file-noselect file)))
diff --git a/.ai/scripts/tests/test-lint-org.el b/.ai/scripts/tests/test-lint-org.el
index d4b3ba0..3a83602 100644
--- a/.ai/scripts/tests/test-lint-org.el
+++ b/.ai/scripts/tests/test-lint-org.el
@@ -342,6 +342,24 @@ content
(should (member 'suspicious-language-in-src-block
(lo-test--checkers judgments)))))
+;; mu4e:msgid: links are registered by mu4e at runtime in a live Emacs; in
+;; batch, org-lint parses them as fuzzy heading refs and reports "Unknown
+;; fuzzy location" — a false positive (home's todo.org, 2026-06-11).
+;; lint-org pre-registers known runtime link types so they parse as links.
+(defconst lo-test--runtime-link "\
+* Heading
+
+See [[mu4e:msgid:abc123@mail.example.com][the thread with Jonathan]].
+")
+
+(ert-deftest lo-runtime-link-type-is-not-flagged ()
+ (let* ((out (lo-test--run lo-test--runtime-link))
+ (res (plist-get out :result))
+ (judgments (lo-test--judgments (plist-get out :issues))))
+ (should (equal lo-test--runtime-link res))
+ (should (= 0 (plist-get out :fixes)))
+ (should-not (member 'invalid-fuzzy-link (lo-test--checkers judgments)))))
+
;;; ---------------------------------------------------------------------------
;;; cj-comment block — Craig's annotation convention is silently suppressed
diff --git a/claude-templates/.ai/scripts/lint-org.el b/claude-templates/.ai/scripts/lint-org.el
index 05365fe..8f55cc6 100644
--- a/claude-templates/.ai/scripts/lint-org.el
+++ b/claude-templates/.ai/scripts/lint-org.el
@@ -70,6 +70,24 @@ path as an org section dated today. The file is created if missing.")
'(item-number missing-language-in-src-block misplaced-planning-info)
"org-lint checker names that are always treated as mechanical.")
+(defvar lo-runtime-link-types '("mu4e")
+ "Org link types registered by packages at runtime in a live Emacs.
+In batch, org doesn't know these types, so org-lint parses
+=[[mu4e:msgid:...]]= as a fuzzy heading ref and reports a false
+invalid-fuzzy-link (\"Unknown fuzzy location\"). Each type listed here is
+registered as a no-op via `org-link-set-parameters' before linting, so the
+link parses as a link. Add a type when a live-Emacs-only link package's
+links start false-flagging in batch runs.")
+
+(defun lo--register-runtime-link-types ()
+ "Register each of `lo-runtime-link-types' so batch org-lint parses them.
+Idempotent: re-registering an already-known type is harmless, and a type
+the running Emacs genuinely provides (e.g. linting interactively with mu4e
+loaded) keeps its real parameters because `org-link-set-parameters' merges
+rather than replaces."
+ (dolist (type lo-runtime-link-types)
+ (org-link-set-parameters type)))
+
;; misplaced-heading is split case-by-case in `lo--handle-item': markdown-bold
;; is auto-fixed, verbatim-asterisk is suppressed as a false positive, anything
;; else is surfaced as judgment.
@@ -365,6 +383,7 @@ Emits one judgment item per violating table."
Resets `lo-fixes' and `lo-issues' for each call. In --check mode the file is
left unmodified and mechanical entries are recorded with :preview t."
(setq lo-current-file file lo-fixes 0 lo-issues nil)
+ (lo--register-runtime-link-types)
(unless lo-check-only
(lo--backup file))
(let ((buf (find-file-noselect file)))
diff --git a/claude-templates/.ai/scripts/tests/test-lint-org.el b/claude-templates/.ai/scripts/tests/test-lint-org.el
index d4b3ba0..3a83602 100644
--- a/claude-templates/.ai/scripts/tests/test-lint-org.el
+++ b/claude-templates/.ai/scripts/tests/test-lint-org.el
@@ -342,6 +342,24 @@ content
(should (member 'suspicious-language-in-src-block
(lo-test--checkers judgments)))))
+;; mu4e:msgid: links are registered by mu4e at runtime in a live Emacs; in
+;; batch, org-lint parses them as fuzzy heading refs and reports "Unknown
+;; fuzzy location" — a false positive (home's todo.org, 2026-06-11).
+;; lint-org pre-registers known runtime link types so they parse as links.
+(defconst lo-test--runtime-link "\
+* Heading
+
+See [[mu4e:msgid:abc123@mail.example.com][the thread with Jonathan]].
+")
+
+(ert-deftest lo-runtime-link-type-is-not-flagged ()
+ (let* ((out (lo-test--run lo-test--runtime-link))
+ (res (plist-get out :result))
+ (judgments (lo-test--judgments (plist-get out :issues))))
+ (should (equal lo-test--runtime-link res))
+ (should (= 0 (plist-get out :fixes)))
+ (should-not (member 'invalid-fuzzy-link (lo-test--checkers judgments)))))
+
;;; ---------------------------------------------------------------------------
;;; cj-comment block — Craig's annotation convention is silently suppressed