[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/calendar/calendar.el, v [EMACS_22_BA
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/calendar/calendar.el, v [EMACS_22_BASE] |
Date: |
Sun, 10 Aug 2008 20:29:16 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Branch: EMACS_22_BASE
Changes by: Glenn Morris <gm> 08/08/10 20:29:16
Index: calendar.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/calendar.el,v
retrieving revision 1.199.2.5
retrieving revision 1.199.2.6
diff -u -b -r1.199.2.5 -r1.199.2.6
--- calendar.el 10 Aug 2008 20:07:11 -0000 1.199.2.5
+++ calendar.el 10 Aug 2008 20:29:15 -0000 1.199.2.6
@@ -1321,15 +1321,17 @@
(defconst lunar-phases-buffer "*Phases of Moon*"
"Name of the buffer used for the lunar phases.")
-(defmacro increment-calendar-month (mon yr n)
+(defmacro increment-calendar-month (mon yr n &optional nmonths)
"Increment the variables MON and YR by N months.
Forward if N is positive or backward if N is negative.
-A negative YR is interpreted as BC; -1 being 1 BC, and so on."
- `(let (macro-y)
+A negative YR is interpreted as BC; -1 being 1 BC, and so on.
+Optional NMONTHS is the number of months per year (default 12)."
+ `(let ((nmonths (or ,nmonths 12))
+ macro-y)
(if (< ,yr 0) (setq ,yr (1+ ,yr))) ; -1 BC -> 0 AD, etc
- (setq macro-y (+ (* ,yr 12) ,mon -1 ,n)
- ,mon (1+ (mod macro-y 12))
- ,yr (/ macro-y 12))
+ (setq macro-y (+ (* ,yr nmonths) ,mon -1 ,n)
+ ,mon (1+ (mod macro-y nmonths))
+ ,yr (/ macro-y nmonths))
(and (< macro-y 0) (> ,mon 1) (setq ,yr (1- ,yr)))
(if (< ,yr 1) (setq ,yr (1- ,yr))))) ; 0 AD -> -1 BC, etc