Nó không phải dễ dàng để làm được điều này, các mã để tạo lịch là:
(defun calendar-generate (month year)
"Generate a three-month Gregorian calendar centered around MONTH, YEAR."
;; A negative YEAR is interpreted as BC; -1 being 1 BC, and so on.
;; Note that while calendars for years BC could be displayed as it
;; stands, almost all other calendar functions (eg holidays) would
;; at best have unpredictable results for such dates.
(if (< (+ month (* 12 (1- year))) 2)
(error "Months before January, 1 AD cannot be displayed"))
(setq displayed-month month
displayed-year year)
(erase-buffer)
(calendar-increment-month month year -1)
(dotimes (i 3)
(calendar-generate-month month year
(+ calendar-left-margin
(* calendar-month-width i)))
(calendar-increment-month month year 1)))
Ở đây, (dotimes (i 3) ...)
tạo 3 tháng liên tiếp.
Vì vậy, nếu bạn muốn tạo nhiều hơn 3 tháng trong hơn 1 hàng, bạn phải ghi đè calendar-generate
chức năng của chính bạn, giống như @Luke nói.
Nguồn
2015-06-29 04:29:46
Bạn dường như đã mã hóa cứng năm nay là năm 2012? Một cái gì đó như thế này có thể thích hợp hơn: '(string-to-number (định dạng-time-string"% Y "(current-time)))' – phils
Vâng, hãy chỉnh sửa. –