diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-16 03:55:49 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-16 03:55:49 -0500 |
| commit | d84aa4374af5e3447445377a836c66cc07d7a223 (patch) | |
| tree | 0d438568f866feef0a036de7a59192b469e231bc /tests/test-prog-lsp--add-file-watch-ignored-extras.el | |
| parent | a005c7636f30b710e27a6812ca989506d5df7531 (diff) | |
| download | dotemacs-d84aa4374af5e3447445377a836c66cc07d7a223.tar.gz dotemacs-d84aa4374af5e3447445377a836c66cc07d7a223.zip | |
refactor(prog): six programming-track hygiene fixes from re-review
- 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 <path>' when vitest is on PATH, otherwise `npx --no-install
jest <path>'. 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.
Diffstat (limited to 'tests/test-prog-lsp--add-file-watch-ignored-extras.el')
| -rw-r--r-- | tests/test-prog-lsp--add-file-watch-ignored-extras.el | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/tests/test-prog-lsp--add-file-watch-ignored-extras.el b/tests/test-prog-lsp--add-file-watch-ignored-extras.el index 142cd2ea..9b71cab8 100644 --- a/tests/test-prog-lsp--add-file-watch-ignored-extras.el +++ b/tests/test-prog-lsp--add-file-watch-ignored-extras.el @@ -87,23 +87,24 @@ (should-error (cj/lsp--add-file-watch-ignored-extras) :type 'wrong-type-argument))) -(ert-deftest test-prog-lsp--remove-eldoc-provider-removes-lsp-provider-locally () - "Normal: remove lsp-mode's Eldoc provider from the buffer-local hook." - (with-temp-buffer - (setq-local eldoc-documentation-functions - '(lsp-eldoc-function eldoc-documentation-default)) - (cj/lsp--remove-eldoc-provider) +(ert-deftest test-prog-lsp--remove-eldoc-provider-global-removes-from-default () + "Normal: remove lsp-mode's Eldoc provider from the global hook value. +The per-buffer removal that this replaced raced lsp-mode's own buffer- +local hook population; removing globally before any LSP buffer attaches +makes the absence stick for every subsequent lsp-managed buffer." + (let ((eldoc-documentation-functions + '(lsp-eldoc-function eldoc-documentation-default))) + (cj/lsp--remove-eldoc-provider-global) (should-not (memq #'lsp-eldoc-function eldoc-documentation-functions)) (should (memq 'eldoc-documentation-default eldoc-documentation-functions)))) -(ert-deftest test-prog-lsp--remove-eldoc-provider-does-not-touch-default-value () - "Boundary: removing the LSP provider in one buffer leaves the default hook alone." - (let ((eldoc-documentation-functions '(lsp-eldoc-function))) - (with-temp-buffer - (setq-local eldoc-documentation-functions '(lsp-eldoc-function)) - (cj/lsp--remove-eldoc-provider) - (should-not (memq #'lsp-eldoc-function eldoc-documentation-functions))) - (should (memq #'lsp-eldoc-function eldoc-documentation-functions)))) +(ert-deftest test-prog-lsp--remove-eldoc-provider-global-is-idempotent () + "Boundary: re-running the removal after the provider is gone is a no-op." + (let ((eldoc-documentation-functions '(eldoc-documentation-default))) + (cj/lsp--remove-eldoc-provider-global) + (cj/lsp--remove-eldoc-provider-global) + (should (equal eldoc-documentation-functions + '(eldoc-documentation-default))))) (ert-deftest test-prog-lsp--module-no-obsolete-lsp-eldoc-hook-reference () "Regression: prog-lsp should not reference obsolete `lsp-eldoc-hook'." |
