summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2006-01-24 17:14:16 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2006-01-24 17:14:16 +0000
commit0d72b43bbbf1eeb3bc8dd7d58abaaead1dc9a4ee (patch)
treef582d8f8605b2c704fa1594e9f3ba12f59253565 /lisp/calendar
parentb8823bf41718e5ba1b07abf7bc3c22da6c46b746 (diff)
downloademacs-0d72b43bbbf1eeb3bc8dd7d58abaaead1dc9a4ee.tar.gz
Avoid macros from calendar.el so as to break
the nastiest part of the cyclic dependency. (cal-menu-update): Use dotimes and calendar-increment-month.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/cal-menu.el46
1 files changed, 22 insertions, 24 deletions
diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el
index 0f8e7295d32..c377bcc8735 100644
--- a/lisp/calendar/cal-menu.el
+++ b/lisp/calendar/cal-menu.el
@@ -1,6 +1,6 @@
;;; cal-menu.el --- calendar functions for menu bar and popup menu support
-;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005
+;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006
;; Free Software Foundation, Inc.
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
@@ -42,7 +42,9 @@
(defvar displayed-month)
(defvar displayed-year)
-(eval-when-compile (require 'calendar))
+;; Don't require calendar because calendar requires us.
+;; (eval-when-compile (require 'calendar))
+(defvar calendar-mode-map)
(define-key calendar-mode-map [menu-bar edit] 'undefined)
(define-key calendar-mode-map [menu-bar search] 'undefined)
@@ -211,14 +213,14 @@ not available."
(condition-case nil
(if (eq major-mode 'calendar-mode)
(let ((l))
- (calendar-for-loop;; Show 11 years--5 before, 5 after year of
- ;; middle month
- i from (- displayed-year 5) to (+ displayed-year 5) do
- (setq l (cons (vector (format "For Year %s" i)
- (list (list 'lambda 'nil '(interactive)
- (list 'list-holidays i i)))
- t)
- l)))
+ ;; Show 11 years--5 before, 5 after year of middle month
+ (dotimes (i 11)
+ (let ((y (+ displayed-year -5 i)))
+ (push (vector (format "For Year %s" y)
+ (list (list 'lambda 'nil '(interactive)
+ (list 'list-holidays y y)))
+ t)
+ l)))
(setq l (cons ["Mark Holidays" mark-calendar-holidays t]
(cons ["Unmark Calendar" calendar-unmark t]
(cons "--" l))))
@@ -231,22 +233,18 @@ not available."
(calendar-date-string (calendar-current-date) t t))
. cal-menu-today-holidays))
(let ((title
- (let ((m1 displayed-month)
- (y1 displayed-year)
- (m2 displayed-month)
- (y2 displayed-year))
- (increment-calendar-month m1 y1 -1)
- (increment-calendar-month m2 y2 1)
- (if (= y1 y2)
+ (let ((my1 (calendar-increment-month -1))
+ (my2 (calendar-increment-month 1)))
+ (if (= (cdr my1) (cdr my2))
(format "%s-%s, %d"
- (calendar-month-name m1 'abbrev)
- (calendar-month-name m2 'abbrev)
- y2)
+ (calendar-month-name (car my1) 'abbrev)
+ (calendar-month-name (car my2) 'abbrev)
+ (cdr my2))
(format "%s, %d-%s, %d"
- (calendar-month-name m1 'abbrev)
- y1
- (calendar-month-name m2 'abbrev)
- y2)))))
+ (calendar-month-name (car my1) 'abbrev)
+ (cdr my1)
+ (calendar-month-name (car my2) 'abbrev)
+ (cdr my2))))))
(define-key calendar-mode-map [menu-bar Holidays 3-month]
`(,(format "For Window (%s)" title)
. list-calendar-holidays)))