aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2006-01-24 17:14:16 +0000
committerStefan Monnier2006-01-24 17:14:16 +0000
commit0d72b43bbbf1eeb3bc8dd7d58abaaead1dc9a4ee (patch)
treef582d8f8605b2c704fa1594e9f3ba12f59253565
parentb8823bf41718e5ba1b07abf7bc3c22da6c46b746 (diff)
downloademacs-0d72b43bbbf1eeb3bc8dd7d58abaaead1dc9a4ee.tar.gz
emacs-0d72b43bbbf1eeb3bc8dd7d58abaaead1dc9a4ee.zip
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.
-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 @@
1;;; cal-menu.el --- calendar functions for menu bar and popup menu support 1;;; cal-menu.el --- calendar functions for menu bar and popup menu support
2 2
3;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005 3;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> 6;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
@@ -42,7 +42,9 @@
42(defvar displayed-month) 42(defvar displayed-month)
43(defvar displayed-year) 43(defvar displayed-year)
44 44
45(eval-when-compile (require 'calendar)) 45;; Don't require calendar because calendar requires us.
46;; (eval-when-compile (require 'calendar))
47(defvar calendar-mode-map)
46 48
47(define-key calendar-mode-map [menu-bar edit] 'undefined) 49(define-key calendar-mode-map [menu-bar edit] 'undefined)
48(define-key calendar-mode-map [menu-bar search] 'undefined) 50(define-key calendar-mode-map [menu-bar search] 'undefined)
@@ -211,14 +213,14 @@ not available."
211 (condition-case nil 213 (condition-case nil
212 (if (eq major-mode 'calendar-mode) 214 (if (eq major-mode 'calendar-mode)
213 (let ((l)) 215 (let ((l))
214 (calendar-for-loop;; Show 11 years--5 before, 5 after year of 216 ;; Show 11 years--5 before, 5 after year of middle month
215 ;; middle month 217 (dotimes (i 11)
216 i from (- displayed-year 5) to (+ displayed-year 5) do 218 (let ((y (+ displayed-year -5 i)))
217 (setq l (cons (vector (format "For Year %s" i) 219 (push (vector (format "For Year %s" y)
218 (list (list 'lambda 'nil '(interactive) 220 (list (list 'lambda 'nil '(interactive)
219 (list 'list-holidays i i))) 221 (list 'list-holidays y y)))
220 t) 222 t)
221 l))) 223 l)))
222 (setq l (cons ["Mark Holidays" mark-calendar-holidays t] 224 (setq l (cons ["Mark Holidays" mark-calendar-holidays t]
223 (cons ["Unmark Calendar" calendar-unmark t] 225 (cons ["Unmark Calendar" calendar-unmark t]
224 (cons "--" l)))) 226 (cons "--" l))))
@@ -231,22 +233,18 @@ not available."
231 (calendar-date-string (calendar-current-date) t t)) 233 (calendar-date-string (calendar-current-date) t t))
232 . cal-menu-today-holidays)) 234 . cal-menu-today-holidays))
233 (let ((title 235 (let ((title
234 (let ((m1 displayed-month) 236 (let ((my1 (calendar-increment-month -1))
235 (y1 displayed-year) 237 (my2 (calendar-increment-month 1)))
236 (m2 displayed-month) 238 (if (= (cdr my1) (cdr my2))
237 (y2 displayed-year))
238 (increment-calendar-month m1 y1 -1)
239 (increment-calendar-month m2 y2 1)
240 (if (= y1 y2)
241 (format "%s-%s, %d" 239 (format "%s-%s, %d"
242 (calendar-month-name m1 'abbrev) 240 (calendar-month-name (car my1) 'abbrev)
243 (calendar-month-name m2 'abbrev) 241 (calendar-month-name (car my2) 'abbrev)
244 y2) 242 (cdr my2))
245 (format "%s, %d-%s, %d" 243 (format "%s, %d-%s, %d"
246 (calendar-month-name m1 'abbrev) 244 (calendar-month-name (car my1) 'abbrev)
247 y1 245 (cdr my1)
248 (calendar-month-name m2 'abbrev) 246 (calendar-month-name (car my2) 'abbrev)
249 y2))))) 247 (cdr my2))))))
250 (define-key calendar-mode-map [menu-bar Holidays 3-month] 248 (define-key calendar-mode-map [menu-bar Holidays 3-month]
251 `(,(format "For Window (%s)" title) 249 `(,(format "For Window (%s)" title)
252 . list-calendar-holidays))) 250 . list-calendar-holidays)))