;;; calendar.el --- calendar functions
;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997,
-;; 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
;; Maintainer: Glenn Morris <rgm@gnu.org>
;; appt.el Appointment notification
;; cal-china.el Chinese calendar
;; cal-coptic.el Coptic/Ethiopic calendars
-;; cal-dst.el Daylight savings time rules
+;; cal-dst.el Daylight saving time rules
;; cal-hebrew.el Hebrew calendar
;; cal-islam.el Islamic calendar
;; cal-bahai.el Baha'i calendar
;; reingold@cs.uiuc.edu with the SUBJECT "send-paper-cal" (no quotes) and
;; the message BODY containing your mailing address (snail).
-;; Comments, corrections, and improvements should be sent to
-;; Edward M. Reingold Department of Computer Science
-;; (217) 333-6733 University of Illinois at Urbana-Champaign
-;; reingold@cs.uiuc.edu 1304 West Springfield Avenue
-;; Urbana, Illinois 61801
-
;;; Code:
(defvar displayed-month)
;; backward-compatibility alias
(put 'holiday-face 'face-alias 'holiday)
-(eval-after-load "facemenu"
- '(progn
- (add-to-list 'facemenu-unlisted-faces 'diary)
- (add-to-list 'facemenu-unlisted-faces 'calendar-today)
- (add-to-list 'facemenu-unlisted-faces 'holiday)))
-
(defcustom diary-entry-marker
(if (not (display-color-p))
"+"
:type 'boolean
:group 'holidays)
+(defcustom calendar-mode-hook nil
+ "Hook run when entering `calendar-mode'."
+ :type 'hook
+ :group 'calendar-hooks)
+
;;;###autoload
(defcustom calendar-load-hook nil
"List of functions to be called after the calendar is first loaded.
Names can be capitalized or not, written in full (as specified by the
variable `calendar-day-name-array'), or abbreviated (as specified by
-`calendar-day-abbrev-array') with or without a period. To take effect,
-this variable should be set before the calendar package and its associates
-are loaded. Otherwise, use one of the functions `european-calendar' or
-`american-calendar' to force the appropriate update."
+`calendar-day-abbrev-array') with or without a period.
+
+Setting this variable directly does not take effect (if the
+calendar package is already loaded). Rather, use either
+\\[customize] or the functions `european-calendar' and
+`american-calendar'."
:type 'boolean
+ ;; Without :initialize (require 'calendar) throws an error because
+ ;; american-calendar is undefined at this point.
+ :initialize 'custom-initialize-default
+ :set (lambda (symbol value)
+ (if value
+ (european-calendar)
+ (american-calendar)))
:group 'diary)
;;;###autoload
(choice symbol regexp)))))
:group 'diary)
+(autoload 'diary-font-lock-keywords "diary-lib")
+(autoload 'diary-live-p "diary-lib")
+(defvar diary-font-lock-keywords)
+
(defcustom diary-date-forms
(if european-calendar-style
european-date-diary-pattern
(repeat (list :inline t :format "%v"
(symbol :tag "Keyword")
(choice symbol regexp)))))
+ :initialize 'custom-initialize-default
+ :set (lambda (symbol value)
+ (unless (equal value (eval symbol))
+ (custom-set-default symbol value)
+ (setq diary-font-lock-keywords (diary-font-lock-keywords))
+ ;; Need to redraw not just to get new font-locking, but also
+ ;; to pick up any newly recognized entries.
+ (and (diary-live-p)
+ (diary))))
:group 'diary)
;;;###autoload
:type 'hook
:group 'diary)
+(autoload 'diary-set-maybe-redraw "diary-lib")
+
;;;###autoload
(defcustom diary-display-hook nil
"List of functions that handle the display of the diary.
diary buffer, set the variable `diary-list-include-blanks' to t."
:type 'hook
:options '(fancy-diary-display)
+ :initialize 'custom-initialize-default
+ :set 'diary-set-maybe-redraw
:group 'diary)
;;;###autoload
(funcall
'holiday-sexp
calendar-daylight-savings-starts
- '(format "Daylight Savings Time Begins %s"
+ '(format "Daylight Saving Time Begins %s"
(if (fboundp 'atan)
(solar-time-string
(/ calendar-daylight-savings-starts-time (float 60))
(funcall
'holiday-sexp
calendar-daylight-savings-ends
- '(format "Daylight Savings Time Ends %s"
+ '(format "Daylight Saving Time Ends %s"
(if (fboundp 'atan)
(solar-time-string
(/ calendar-daylight-savings-ends-time (float 60))
(calendar-only-one-frame-setup arg))
(t (calendar-basic-setup arg))))
+(autoload 'diary-view-entries "diary-lib"
+ "Prepare and display a buffer with diary entries.
+Searches your diary file for entries that match ARG days starting with
+the date indicated by the cursor position in the displayed three-month
+calendar."
+ t)
+
+(autoload 'list-calendar-holidays "holidays"
+ "Create a buffer containing the holidays for the current calendar window.
+The holidays are those in the list `calendar-notable-days'. Returns t if any
+holidays are found, nil if not."
+ t)
+
(defun calendar-basic-setup (&optional arg)
"Display a three-month calendar in another window.
The three months appear side by side, with the current month in the middle
(list-calendar-holidays)))
(run-hooks 'initial-calendar-window-hook))
-(autoload 'diary-view-entries "diary-lib"
- "Prepare and display a buffer with diary entries.
-Searches your diary file for entries that match ARG days starting with
-the date indicated by the cursor position in the displayed three-month
-calendar."
- t)
-
(autoload 'view-other-diary-entries "diary-lib"
"Prepare and display buffer of diary entries from an alternative diary file.
Searches for entries that match ARG days, starting with the date indicated
to the date indicated by point."
t)
-(autoload 'list-calendar-holidays "holidays"
- "Create a buffer containing the holidays for the current calendar window.
-The holidays are those in the list `calendar-notable-days'. Returns t if any
-holidays are found, nil if not."
- t)
-
(autoload 'cal-tex-cursor-month "cal-tex"
"Make a buffer with LaTeX commands for the month cursor is on.
Optional prefix argument specifies number of months to be produced.
"Make a buffer with LaTeX commands for a year's calendar (Filofax).
Optional prefix argument specifies number of years." t)
+(autoload 'cal-html-cursor-month "cal-html"
+ "Write an HTML calendar file for numeric MONTH of four-digit YEAR.
+The output directory DIR is created if necessary. Interactively,
+MONTH and YEAR are taken from the calendar cursor position. Note
+that any existing output files are overwritten." t)
+
+(autoload 'cal-html-cursor-year "cal-html"
+ "Write HTML calendar files (index and monthly pages) for four-digit YEAR.
+The output directory DIR is created if necessary. Interactively,
+YEAR is taken from the calendar cursor position. Note that any
+existing output files are overwritten." t)
+
(autoload 'mark-calendar-holidays "holidays"
"Mark notable days in the calendar window."
t)
downcase-region upcase-region kill-region
copy-region-as-kill capitalize-region write-region))
(define-key map (vector 'remap c) 'calendar-not-implemented))
- (define-key map ">" 'scroll-calendar-right)
- (define-key map "\C-x>" 'scroll-calendar-right)
+ (define-key map "<" 'scroll-calendar-right)
+ (define-key map "\C-x<" 'scroll-calendar-right)
(define-key map [prior] 'scroll-calendar-right-three-months)
(define-key map "\ev" 'scroll-calendar-right-three-months)
- (define-key map "<" 'scroll-calendar-left)
- (define-key map "\C-x<" 'scroll-calendar-left)
+ (define-key map ">" 'scroll-calendar-left)
+ (define-key map "\C-x>" 'scroll-calendar-left)
(define-key map [next] 'scroll-calendar-left-three-months)
(define-key map "\C-v" 'scroll-calendar-left-three-months)
(define-key map "\C-b" 'calendar-backward-day)
(define-key map "m" 'mark-diary-entries)
(define-key map "d" 'diary-view-entries)
(define-key map "D" 'view-other-diary-entries)
- (define-key map "s" 'show-all-diary-entries)
+ (define-key map "s" 'diary-show-all-entries)
(define-key map "pd" 'calendar-print-day-of-year)
(define-key map "pC" 'calendar-print-chinese-date)
(define-key map "pk" 'calendar-print-coptic-date)
(define-key map "iBm" 'insert-monthly-bahai-diary-entry)
(define-key map "iBy" 'insert-yearly-bahai-diary-entry)
(define-key map "?" 'calendar-goto-info-node)
+ (define-key map "Hm" 'cal-html-cursor-month)
+ (define-key map "Hy" 'cal-html-cursor-year)
(define-key map "tm" 'cal-tex-cursor-month)
(define-key map "tM" 'cal-tex-cursor-month-landscape)
(define-key map "td" 'cal-tex-cursor-day)
(defvar calendar-mode-line-format
(list
- (propertize (substitute-command-keys
- "\\<calendar-mode-map>\\[scroll-calendar-left]")
- 'help-echo "mouse-2: scroll left"
+ (propertize "<"
+ 'help-echo "mouse-1: previous month"
'mouse-face 'mode-line-highlight
- 'keymap (make-mode-line-mouse-map 'mouse-2
- 'mouse-scroll-calendar-left))
+ 'keymap (make-mode-line-mouse-map 'mouse-1
+ 'mouse-scroll-calendar-right))
"Calendar"
(concat
(propertize
(substitute-command-keys
"\\<calendar-mode-map>\\[calendar-goto-info-node] info")
- 'help-echo "mouse-2: read Info on Calendar"
+ 'help-echo "mouse-1: read Info on Calendar"
'mouse-face 'mode-line-highlight
- 'keymap (make-mode-line-mouse-map 'mouse-2 'calendar-goto-info-node))
- "/"
+ 'keymap (make-mode-line-mouse-map 'mouse-1 'calendar-goto-info-node))
+ " / "
(propertize
(substitute-command-keys
- "\\<calendar-mode-map>\\[calendar-other-month] other")
- 'help-echo "mouse-2: choose another month"
+ " \\<calendar-mode-map>\\[calendar-other-month] other")
+ 'help-echo "mouse-1: choose another month"
'mouse-face 'mode-line-highlight
'keymap (make-mode-line-mouse-map
- 'mouse-2 'mouse-calendar-other-month))
- "/"
+ 'mouse-1 'mouse-calendar-other-month))
+ " / "
(propertize
(substitute-command-keys
"\\<calendar-mode-map>\\[calendar-goto-today] today")
- 'help-echo "mouse-2: go to today's date"
+ 'help-echo "mouse-1: go to today's date"
'mouse-face 'mode-line-highlight
- 'keymap (make-mode-line-mouse-map 'mouse-2 #'calendar-goto-today)))
+ 'keymap (make-mode-line-mouse-map 'mouse-1 #'calendar-goto-today)))
'(calendar-date-string (calendar-current-date) t)
- (propertize (substitute-command-keys
- "\\<calendar-mode-map>\\[scroll-calendar-right]")
- 'help-echo "mouse-2: scroll right"
+ (propertize ">"
+ 'help-echo "mouse-1: next month"
'mouse-face 'mode-line-highlight
'keymap (make-mode-line-mouse-map
- 'mouse-2 'mouse-scroll-calendar-right)))
+ 'mouse-1 'mouse-scroll-calendar-left)))
"The mode line of the calendar buffer.
This must be a list of items that evaluate to strings--those strings are