diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-23 13:05:33 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-23 13:05:33 -0500 |
| commit | b70781e8eeaa67cf2a1aa804c27b92f38fd52742 (patch) | |
| tree | 4d4bda78b3457a470880314abc3e16c65478ba17 /modules/linear-config.el | |
| parent | b7323a37a37a5948716060edb508a4c5791117b5 (diff) | |
| download | dotemacs-b70781e8eeaa67cf2a1aa804c27b92f38fd52742.tar.gz dotemacs-b70781e8eeaa67cf2a1aa804c27b92f38fd52742.zip | |
fix(linear): load API key for check-setup and pin org file to emacs home
linear-emacs-check-setup read linear-emacs-api-key directly and bailed to "API key is not set" before making any request, so the lazy :before advice on the GraphQL request never fired for it. A fresh session always reported the key missing even though it was in authinfo. I extracted cj/linear--install-key-advice and put the loader on check-setup as well as the request entry point, with a regression test.
I also pinned linear-emacs-org-file-path to data/linear.org inside emacs home, next to the calendar-sync output. Left to its default it falls back to org-directory/gtd/linear.org and silently created a stray ~/org tree on the first pull.
The init.el require is commented out for now while linear-emacs is reworked. The config will need rework once that lands.
Diffstat (limited to 'modules/linear-config.el')
| -rw-r--r-- | modules/linear-config.el | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/modules/linear-config.el b/modules/linear-config.el index f92c13ce..479f72e4 100644 --- a/modules/linear-config.el +++ b/modules/linear-config.el @@ -50,6 +50,17 @@ GPG prompt fires at most once per session and only when Linear is actually used. Named (not a lambda) so the advice is idempotent across reloads and removable." (cj/linear--ensure-api-key)) +(defun cj/linear--install-key-advice () + "Install the lazy API-key loader on every entry point that needs the key. +The GraphQL request funnels all real operations. `linear-emacs-check-setup' +reads `linear-emacs-api-key' directly without making a request, so it needs the +loader too — otherwise it reports \"not set\" on a fresh session before the key +has ever been fetched." + (advice-add 'linear-emacs--graphql-request-async :before + #'cj/linear--ensure-key-before) + (advice-add 'linear-emacs-check-setup :before + #'cj/linear--ensure-key-before)) + (use-package linear-emacs :ensure nil ;; local checkout, not from an archive :load-path "~/code/linear-emacs" @@ -63,10 +74,15 @@ Named (not a lambda) so the advice is idempotent across reloads and removable." linear-emacs-check-setup) :config (setq linear-emacs-default-team-id cj/linear-team-id) - ;; Load the key before any GraphQL request — lazy, and it retries if the key - ;; was added to authinfo after a first (failed) attempt this session. - (advice-add 'linear-emacs--graphql-request-async :before - #'cj/linear--ensure-key-before)) + ;; Keep the synced org file inside emacs home, next to the calendar-sync + ;; output (gcal.org / pcal.org / dcal.org). Without this it falls back to + ;; `org-directory'/gtd/linear.org and silently creates a stray ~/org tree. + (setq linear-emacs-org-file-path + (expand-file-name "data/linear.org" user-emacs-directory)) + ;; Load the key lazily before any operation that reads it — both the GraphQL + ;; request and the check-setup diagnostic. Retries if the key was added to + ;; authinfo after a first (failed) attempt this session. + (cj/linear--install-key-advice)) ;; ------------------------------ Keybindings ---------------------------------- |
