【发布时间】:2010-11-29 18:15:59
【问题描述】:
我正在尝试在我的.emacs 中实施节气,因此我的“假期”将显示太阳经度穿过每个 15 度的倍数的时间。这是相关的片段。
(defun next-solar-term-date (d)
(solar-date-next-longitude d 15))
(defconst solar-term-names
["moderate cold" "severe cold" "spring commerces"
"rain water" "insects awaken" "vernal equinox"
"Ching Ming" "corn rain" "summer commerces"
"corn forms" "corn on ear" "summer solstice"
"minor heat" "great heat" "autumn commerces"
"end of heat" "white dew" "autumnal equinox"
"cold dew" "frost" "winter commerces"
"light snow" "heavy snow" "winter solstice"])
(setq solar-terms-holidays
(let* ((k 0) (mylist nil))
(dotimes (k 4);k=season
(let* ((j 0))
(dotimes (j 5);no equinoxes/solstices --- use solar for them
(let* ((i (+ j (* 6 k)))
(month (+ 1 (/ i 2)))
(astronextdate (next-solar-term-date
(calendar-astro-from-absolute
(+ (* 15 i)
(calendar-absolute-from-gregorian
(list 1 1 displayed-year))))))
(s (aref solar-term-names i))
(absnextdate (calendar-absolute-from-astro
astronextdate))
(gregnextdate (calendar-gregorian-from-absolute
(floor absnextdate)))
(compt (* 24 (- absnextdate (floor absnextdate))))
(str (concat s " "
(solar-time-string
compt (if (dst-in-effect absnextdate)
calendar-daylight-time-zone-name
calendar-standard-time-zone-name))))
(d (extract-calendar-day gregnextdate)))
(setq mylist (append mylist
(list
(list 'holiday-fixed month d str))))))))
mylist))
但是,emacs(Gentoo 上的版本 23.2-r2)抱怨显示年份在启动时是一个无效变量,并且尝试使用 Mx calendar RET 生成日历没有帮助任何一个。知道我该如何解决吗? (当然不是在我的.emacs 中定义显示年份,因为这肯定会搞砸其他一切......)
【问题讨论】:
-
您是否需要在日历中并在运行此功能之前加载它?