diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-16 00:14:17 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-16 00:14:17 -0500 |
| commit | 17e0e7f1828be538e95e933ebf454d655eb7bdea (patch) | |
| tree | e30704e61f08a4f39a2e2cc60b33e5aa8540634e /tests/test-ai-config-gptel-commands.el | |
| parent | 549808155cc45ca12a66915c6a195b1c00d4618b (diff) | |
| download | dotemacs-17e0e7f1828be538e95e933ebf454d655eb7bdea.tar.gz dotemacs-17e0e7f1828be538e95e933ebf454d655eb7bdea.zip | |
fix(ai-config): intern model in gptel-switch-backend (modeline hang)
cj/gptel-switch-backend set gptel-model to the raw completing-read string. gptel's modeline code calls symbolp on gptel-model and signals wrong-type-argument on a string, which surfaces as a redisplay hang (reachable from C-; a B). The sibling command cj/gptel-change-model already interns. This one didn't.
I added a pure cj/gptel--model-to-symbol helper (mirroring cj/gptel--model-to-string) and route the model through it before the setq. The existing switch-backend test asserted the buggy string value. It now asserts a symbol plus an explicit symbolp guard.
Diffstat (limited to 'tests/test-ai-config-gptel-commands.el')
| -rw-r--r-- | tests/test-ai-config-gptel-commands.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/test-ai-config-gptel-commands.el b/tests/test-ai-config-gptel-commands.el index b87c4975..371a75cc 100644 --- a/tests/test-ai-config-gptel-commands.el +++ b/tests/test-ai-config-gptel-commands.el @@ -77,7 +77,10 @@ (lambda (fmt &rest args) (setq msg (apply #'format fmt args))))) (cj/gptel-switch-backend)) (should (eq gptel-backend 'anthropic-backend)) - (should (equal gptel-model "claude-opus")) + ;; gptel-model must be a symbol, not the raw completing-read string: + ;; gptel's modeline calls `symbolp' on it and hangs redisplay otherwise. + (should (symbolp gptel-model)) + (should (eq gptel-model 'claude-opus)) (should (string-match-p "Anthropic - Claude" msg)))) (ert-deftest test-ai-config-switch-backend-error-invalid-choice () |
