Skip to content

Commit

Permalink
Avoid evaluating void variables
Browse files Browse the repository at this point in the history
The last `unless` case of `unicode-tokens-copy-configuration-variables` tries
to evaluate variables which may be undefined via `symbol-value`, which leads to
an error. This commit adds a check to make sure the variables are only accessed
if bound.
  • Loading branch information
haselwarter committed Feb 13, 2024
1 parent 4e6e5d9 commit 565ec9a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/unicode-tokens.el
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,13 @@ if it is bound; it should be the name of a variable."
(setq unicode-tokens-shortcut-replacement-alist
unicode-tokens-shortcut-alist))
(unless unicode-tokens-tokens-customizable-variables
(let ((f (lambda (sym) (when (boundp sym) (symbol-value sym)))))
(setq unicode-tokens-tokens-customizable-variables
(list
(list "Token Map"
(symbol-value (unicode-tokens-config-var 'token-symbol-map)))
(funcall f (unicode-tokens-config-var 'token-symbol-map)))
(list "Shortcut List"
(symbol-value (unicode-tokens-config-var 'shortcut-alist)))))))
(funcall f (unicode-tokens-config-var 'shortcut-alist))))))))

;;
;; Variables set in the mode
Expand Down

0 comments on commit 565ec9a

Please sign in to comment.