diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-26 15:06:42 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-26 15:06:42 -0500 |
| commit | 02d1c7b009f109a83a6c62ae56f4a3a9ba2d21e3 (patch) | |
| tree | 40e2d12dfede9e93423a3fc163229a8d453fe265 /pearl.el | |
| parent | 41a33964c6b97858a17fd12288592b03d5df68d9 (diff) | |
| download | pearl-02d1c7b009f109a83a6c62ae56f4a3a9ba2d21e3.tar.gz pearl-02d1c7b009f109a83a6c62ae56f4a3a9ba2d21e3.zip | |
refactor: remove the dead state-to-todo mapping subsystem
`pearl-state-to-todo-mapping` and its derived regex stopped doing real work once keyword rendering moved to slugifying the Linear state name (`pearl--state-name-to-keyword`) and the keyword-to-state direction moved to resolving through the team's workflow states. The defcustom fed only `pearl--get-todo-states-pattern`, which had no caller left, and the two cache vars existed only to serve that dead function. State extraction reads `org-get-todo-state` off the buffer's `#+TODO` line, so nothing live touched the mapping.
I removed the defcustom, both cache vars, and the dead function, and dropped the three pattern tests that exercised it. Removing the defcustom orphaned the mapping bindings that ~12 test setup macros still carried. They were passing through slugification rather than the map, so I stripped them too and kept the `org-todo-keywords` bindings the temp buffers actually need. Also dropped the stale README config row.
Diffstat (limited to 'pearl.el')
| -rw-r--r-- | pearl.el | 47 |
1 files changed, 2 insertions, 45 deletions
@@ -101,22 +101,6 @@ Defaults to \\='gtd/linear.org\\=' in your `org-directory'." :type 'file :group 'pearl) -(defcustom pearl-state-to-todo-mapping - '(("Todo" . "TODO") - ("In Progress" . "IN-PROGRESS") - ("In Review" . "IN-REVIEW") - ("Backlog" . "BACKLOG") - ("Blocked" . "BLOCKED") - ("Done" . "DONE")) - "Mapping between Linear state names and Org TODO keywords, for rendering. -Each element is a cons cell (LINEAR-STATE . ORG-STATE). It controls how a -Linear state renders as an Org TODO keyword and how an Org keyword maps back -on sync. It no longer decides which issues appear: inclusion is now a -server-side query concern (see `pearl-list-issues'). A Linear state -not listed here renders with the default TODO keyword." - :type '(alist :key-type string :value-type string) - :group 'pearl) - (defcustom pearl-async-default t "Use async API calls by default. When t, all API calls will be asynchronous unless explicitly overridden. @@ -283,17 +267,6 @@ not sprawl open. A no-op when `pearl-fold-after-update' is nil." 'org-set-startup-visibility)) (pearl--hide-all-drawers))) -(defvar pearl-todo-states-pattern nil - "Cached regex pattern for matching Org TODO states. -This pattern is generated from `pearl-state-to-todo-mapping'. -Use `pearl--get-todo-states-pattern' to get the pattern.") - -(defvar pearl--todo-states-pattern-source nil - "Mapping the cached pattern was built from. -Holds the `pearl-state-to-todo-mapping' value used to build -`pearl-todo-states-pattern', so the cache can be invalidated -when the mapping changes.") - ;; Cache variables (defvar pearl--cache-teams nil @@ -1535,8 +1508,8 @@ there is no network lookup here." Upcased, each run of non-alphanumerics replaced by a single hyphen (alnum is Unicode-aware, so accented and non-Latin letters survive), with leading and trailing hyphens trimmed. An all-symbol name (empty slug) falls back to -\"TODO\". This is the workspace-faithful replacement for the static -`pearl-state-to-todo-mapping' lookup." +\"TODO\". This is the workspace-faithful replacement for the former static +state-name-to-keyword mapping." (let ((slug (string-trim (replace-regexp-in-string "[^[:alnum:]]+" "-" (upcase (or name ""))) "-+" "-+"))) @@ -1565,22 +1538,6 @@ file always has a valid `#+TODO:' line." (concat active-str " |" (if (string-empty-p done-str) "" (concat " " done-str))))))) -(defun pearl--get-todo-states-pattern () - "Return the regex pattern matching the Org TODO states. -Built from the org keywords in `pearl-state-to-todo-mapping' and -cached in `pearl-todo-states-pattern'. The cache is rebuilt when -the mapping changes, so a mid-session `setq' or customization takes effect." - (unless (and pearl-todo-states-pattern - (eq pearl--todo-states-pattern-source - pearl-state-to-todo-mapping)) - ;; Pattern like "TODO\\|IN-PROGRESS\\|IN-REVIEW\\|BACKLOG\\|BLOCKED\\|DONE". - (setq pearl--todo-states-pattern-source pearl-state-to-todo-mapping - pearl-todo-states-pattern - (mapconcat #'regexp-quote - (mapcar #'cdr pearl-state-to-todo-mapping) - "\\|"))) - pearl-todo-states-pattern) - (defun pearl--map-linear-priority-to-org (priority-num) "Convert Linear PRIORITY-NUM to an Org priority cookie, or \"\" for none. PRIORITY-NUM is 0=None, 1=Urgent, 2=High, 3=Medium, 4=Low. None (0), nil, and |
