Use let* instead of let
gongzhitaao opened this issue ยท 2 comments
gongzhitaao commented
It would be much easier and less error-prone if we use let*
instead of let
. let*
allows to use the variable defined before the current line. For example:
(let* ((class '((class color) (min-colors 89)))
;; omit lines
(nord12 (if (nord-display-truecolor-or-graphic-p) "#D08770" "brightyellow"))
;; omit lines
;; (nord-annotation (if (nord-display-truecolor-or-graphic-p) "#D08770 "brightyellow")) <-- original
(nord-annotation (if (nord-display-truecolor-or-graphic-p) nord12 "brightyellow"))
arcticicestudio commented
Hi @gongzhitaao ๐, thanks for your contribution ๐
That sounds like a good and inexpensive improvement ๐
Unfortunately I'm not really familiar with Lisp at all so I'll need to check and test if there might be problems when it comes to the special Emacs Lisp syntax derivations.
Maybe someone with more experience post some feedback or some examples/links if it is used in other popular themes too without any disadvantages.
gongzhitaao commented
Some examples:
- Solarized: https://github.com/bbatsov/solarized-emacs/blob/master/solarized.el#L242
- sanityinc-tomorrow: https://github.com/purcell/color-theme-sanityinc-tomorrow/blob/master/color-theme-sanityinc-tomorrow.el#L144
- Monokai: https://github.com/oneKelvinSmith/monokai-emacs/blob/master/monokai-theme.el#L188
- Emacs one: https://github.com/balajisivaraman/emacs-one-themes/blob/master/one-themes.el#L77
The only different between let*
and let
is let*
allows you to use variables previously defined.