From 17e0e7f1828be538e95e933ebf454d655eb7bdea Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 16 Jun 2026 00:14:17 -0500 Subject: 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. --- tests/test-ai-config-gptel-commands.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/test-ai-config-gptel-commands.el') 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 () -- cgit v1.2.3