以下伪代码的elisp代码
if "the emacs version is less than 23.1.x"
do
something
else
something-else
写成
(if (or (< emacs-major-version 23)
(and (= emacs-major-version 23)
(<= emacs-minor-version 1)))
(setq color-theme-is-global t)
(color-theme-initialize))
如何优化上述代码,以便“emacs-major-version”不会被引用两次。
答案 0 :(得分:11)
不需要,version<=
和emacs-version
(if (version<= emacs-version "23.1")
(setq color-theme-is-global t)
(color-theme-initialize))