nordtheme / emacs

An arctic, north-bluish clean and elegant Emacs theme.
https://www.nordtheme.com/ports/emacs
MIT License
488 stars 62 forks source link

Use let* instead of let #96

Open gongzhitaao opened 4 years ago

gongzhitaao commented 4 years ago

https://github.com/arcticicestudio/nord-emacs/blob/d828752e270978a56bde19986c98b1bbe8f51386/nord-theme.el#L101

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 4 years ago

Hi @gongzhitaao :wave:, thanks for your contribution :+1:

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 4 years ago

Some examples:

The only different between let* and let is let* allows you to use variables previously defined.