fix(lib): doom-set-indent: handling nil or undefined vars

When indent variables registered with `set-indent-vars!` aren't defined
or are nil when `doom-set-indent` is called.

Fix: #8730
Amend: 5e290e8e79
Amend: c0662f6ea1
This commit is contained in:
Henrik Lissner 2026-03-30 18:13:33 -04:00
parent ed67d0dde3
commit eb40bec314
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -61,7 +61,11 @@ with `set-indent-vars!'."
(defun doom-set-indent (&optional width)
"Ensure tab-width reflects the local major mode's indent variable."
(when-let* ((vars (doom-indent-vars-for-mode major-mode))
(width* (or width (cl-some #'symbol-value vars))))
(width* (or width
(cl-loop for v in vars
if (boundp v)
if (symbol-value v)
return it))))
(doom-log 2 "doom-set-indent: %S = %S" `(tab-width standard-indent ,@vars) width*)
(setq-local tab-width width*
standard-indent width*)