From d84aa4374af5e3447445377a836c66cc07d7a223 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 16 May 2026 03:55:49 -0500 Subject: refactor(prog): six programming-track hygiene fixes from re-review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - prog-lsp.el: rename `cj/lsp--remove-eldoc-provider' → `cj/lsp--remove-eldoc-provider-global' and call it once from the lsp-mode `:config' block instead of attaching it per-buffer via `lsp-managed-mode-hook'. The previous per-buffer remove with the buffer-local flag raced lsp-mode's own population of the local hook; removing the provider from the global default before any LSP buffer attaches makes the absence stick. Two existing tests updated to the new contract (remove-from-default + idempotent re-run). - prog-webdev.el / prog-python.el: warn at load time when `prettier' or `pyright' is missing on PATH via `cj/executable-find-or-warn'. Both modules now `(require 'system-lib)' to expose the helper. Missing dependencies surface up front instead of mid-edit at first format/LSP attach. - keyboard-compat.el: document existing idempotence. The hook install uses a named function so `add-hook' deduplicates, and the hook body only calls `define-key' (latest binding wins, same value) -- adding a comment so future readers don't re-question. - dev-fkeys.el: add a `typescript' clause to `cj/--f6-test-runner-cmd-for'. F6 now runs `npx --no-install vitest ' when vitest is on PATH, otherwise `npx --no-install jest '. Updates the matching test from "returns nil" to cover both code paths; the impl-level test now asserts the routed command instead of expecting a user-error. - flycheck-config.el: build the LanguageTool wrapper path with `(expand-file-name "scripts/languagetool-flycheck" user-emacs-directory)' instead of a hardcoded `~/.emacs.d/...'. Survives a non-standard `user-emacs-directory'. - latex-config.el: replace the hardcoded Zathura viewer with `cj/--latex-select-pdf-viewer', which walks `cj/--latex-pdf-viewer-candidates' (zathura → evince → okular → SumatraPDF → xdg-open) and falls back to "PDF Tools" when nothing is on PATH. Each entry maps an executable to the matching TeX-view-program-list name so AUCTeX's defaults handle the actual viewer invocation. --- modules/prog-lsp.el | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'modules/prog-lsp.el') diff --git a/modules/prog-lsp.el b/modules/prog-lsp.el index e03a475d6..045dda248 100644 --- a/modules/prog-lsp.el +++ b/modules/prog-lsp.el @@ -48,10 +48,15 @@ Idempotent — `add-to-list' skips patterns already present." (dolist (pattern cj/lsp-file-watch-ignored-extras) (add-to-list 'lsp-file-watch-ignored-directories pattern))) -(defun cj/lsp--remove-eldoc-provider () - "Remove lsp-mode's provider from `eldoc-documentation-functions' here. -Buffer-local — the global hook value is untouched." - (remove-hook 'eldoc-documentation-functions #'lsp-eldoc-function t)) +(defun cj/lsp--remove-eldoc-provider-global () + "Remove lsp-mode's provider from the global `eldoc-documentation-functions'. +Run once after lsp-mode loads. The previous per-buffer removal raced +lsp's own buffer-local add: the buffer-local remove fired before lsp +populated the buffer-local hook (lsp inherits the global default and +mutates from there), so the buffer-local hook ended up holding the +provider anyway. Removing globally before lsp ever attaches a buffer +makes the absence stick for every subsequent lsp-managed buffer." + (remove-hook 'eldoc-documentation-functions #'lsp-eldoc-function)) ;;;;; ---------------------------- LSP Mode --------------------------- @@ -73,7 +78,10 @@ Buffer-local — the global hook value is untouched." (setq lsp-enable-on-type-formatting nil) (setq lsp-signature-auto-activate nil) (setq lsp-signature-render-documentation nil) - (add-hook 'lsp-managed-mode-hook #'cj/lsp--remove-eldoc-provider) + ;; Strip lsp-mode's eldoc provider from the GLOBAL hook value once, + ;; not per buffer. See `cj/lsp--remove-eldoc-provider-global' for + ;; why per-buffer racing didn't stick. + (cj/lsp--remove-eldoc-provider-global) (setq lsp-modeline-code-actions-enable nil) (setq lsp-modeline-diagnostics-enable nil) (setq lsp-headerline-breadcrumb-enable nil) -- cgit v1.2.3