Improving Elisp Conditional Expression

Elisp code for pseudo code below

if "the emacs version is less than 23.1.x" do something else something-else 

is written as

 (if (or (< emacs-major-version 23) (and (= emacs-major-version 23) (<= emacs-minor-version 1))) (setq color-theme-is-global t) (color-theme-initialize)) 

How to optimize the above code so that "emacs-major-version" is not referenced twice.

+4
source share
1 answer

There is no need for this, there version<= and emacs-version

 (if (version<= emacs-version "23.1") (setq color-theme-is-global t) (color-theme-initialize)) 
+11
source

All Articles