diff options
| author | Glenn Morris | 2008-03-31 07:11:00 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-03-31 07:11:00 +0000 |
| commit | f6c762dde18999e3ddd5bb7dfbc724aa9687715d (patch) | |
| tree | 8d6a8e710c176f13911a863c199fc68831fdd720 | |
| parent | 1d2a9d53ab6604742cb7380502725dfa445a2d50 (diff) | |
| download | emacs-f6c762dde18999e3ddd5bb7dfbc724aa9687715d.tar.gz emacs-f6c762dde18999e3ddd5bb7dfbc724aa9687715d.zip | |
(increment-calendar-month): Doc fix.
(calendar-date-is-visible-p): Doc fix. Simplify.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/calendar/calendar.el | 19 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d8d5d73a1b7..90ff6ffce9b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -14,6 +14,9 @@ | |||
| 14 | * calendar/cal-julian.el (holiday-julian): Fix a problem with holidays | 14 | * calendar/cal-julian.el (holiday-julian): Fix a problem with holidays |
| 15 | in the last fortnight in Julian October. | 15 | in the last fortnight in Julian October. |
| 16 | 16 | ||
| 17 | * calendar/calendar.el (increment-calendar-month): Doc fix. | ||
| 18 | (calendar-date-is-visible-p): Doc fix. Simplify. | ||
| 19 | |||
| 17 | * calendar/holidays.el (holiday-filter-visible-calendar): Return result | 20 | * calendar/holidays.el (holiday-filter-visible-calendar): Return result |
| 18 | from dolist. | 21 | from dolist. |
| 19 | 22 | ||
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 743dc33648f..cd39f1ebbac 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -1216,12 +1216,17 @@ with descriptive strings such as | |||
| 1216 | (defmacro increment-calendar-month (mon yr n) | 1216 | (defmacro increment-calendar-month (mon yr n) |
| 1217 | "Increment the variables MON and YR by N months. | 1217 | "Increment the variables MON and YR by N months. |
| 1218 | Forward if N is positive or backward if N is negative. | 1218 | Forward if N is positive or backward if N is negative. |
| 1219 | A negative YR is interpreted as BC; -1 being 1 BC, and so on." | 1219 | A negative YR is interpreted as BC; -1 being 1 BC, and so on. |
| 1220 | This is only appropriate for calendars with 12 months per year." | ||
| 1220 | `(let (macro-y) | 1221 | `(let (macro-y) |
| 1222 | ;; FIXME 12 could be an optional arg, if needed. | ||
| 1221 | (if (< ,yr 0) (setq ,yr (1+ ,yr))) ; -1 BC -> 0 AD, etc | 1223 | (if (< ,yr 0) (setq ,yr (1+ ,yr))) ; -1 BC -> 0 AD, etc |
| 1222 | (setq macro-y (+ (* ,yr 12) ,mon -1 ,n) | 1224 | (setq macro-y (+ (* ,yr 12) ,mon -1 ,n) |
| 1223 | ,mon (1+ (mod macro-y 12)) | 1225 | ,mon (1+ (mod macro-y 12)) |
| 1224 | ,yr (/ macro-y 12)) | 1226 | ,yr (/ macro-y 12)) |
| 1227 | ;;; (setq macro-y (+ (* ,yr 12) ,mon -1 ,n) | ||
| 1228 | ;;; ,yr (/ macro-y 12) | ||
| 1229 | ;;; ,mon (- macro-y (* ,yr 12))) | ||
| 1225 | (and (< macro-y 0) (> ,mon 1) (setq ,yr (1- ,yr))) | 1230 | (and (< macro-y 0) (> ,mon 1) (setq ,yr (1- ,yr))) |
| 1226 | (if (< ,yr 1) (setq ,yr (1- ,yr))))) ; 0 AD -> -1 BC, etc | 1231 | (if (< ,yr 1) (setq ,yr (1- ,yr))))) ; 0 AD -> -1 BC, etc |
| 1227 | 1232 | ||
| @@ -1257,6 +1262,7 @@ inclusive. The standard macro `dotimes' is preferable in most cases." | |||
| 1257 | ,index (1+ ,index))) | 1262 | ,index (1+ ,index))) |
| 1258 | sum)) | 1263 | sum)) |
| 1259 | 1264 | ||
| 1265 | ;; FIXME bind q to bury-buffer? | ||
| 1260 | (defmacro calendar-in-read-only-buffer (buffer &rest body) | 1266 | (defmacro calendar-in-read-only-buffer (buffer &rest body) |
| 1261 | "Switch to BUFFER and executes the forms in BODY. | 1267 | "Switch to BUFFER and executes the forms in BODY. |
| 1262 | First creates or erases BUFFER as needed. Leaves BUFFER read-only, | 1268 | First creates or erases BUFFER as needed. Leaves BUFFER read-only, |
| @@ -2310,11 +2316,12 @@ interpreted as BC; -1 being 1 BC, and so on." | |||
| 2310 | (redraw-calendar)) | 2316 | (redraw-calendar)) |
| 2311 | 2317 | ||
| 2312 | (defun calendar-date-is-visible-p (date) | 2318 | (defun calendar-date-is-visible-p (date) |
| 2313 | "Return t if DATE is valid and is visible in the calendar window." | 2319 | "Return non-nil if DATE is valid and is visible in the calendar window." |
| 2314 | (let ((gap (calendar-interval | 2320 | (and (calendar-date-is-valid-p date) |
| 2315 | displayed-month displayed-year | 2321 | (< (abs (calendar-interval |
| 2316 | (extract-calendar-month date) (extract-calendar-year date)))) | 2322 | displayed-month displayed-year |
| 2317 | (and (calendar-date-is-valid-p date) (> 2 gap) (< -2 gap)))) | 2323 | (extract-calendar-month date) (extract-calendar-year date))) |
| 2324 | 2))) | ||
| 2318 | 2325 | ||
| 2319 | (defun calendar-date-is-valid-p (date) | 2326 | (defun calendar-date-is-valid-p (date) |
| 2320 | "Return t if DATE is a valid date." | 2327 | "Return t if DATE is a valid date." |