aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Rost2002-11-16 19:19:35 +0000
committerMarkus Rost2002-11-16 19:19:35 +0000
commit5d22135b02c94cb9f75dc2458480c6065d48608c (patch)
tree60c045942fc8c825dc8eba03d4fc4e956921e675
parent86432f811eb38e79a87f476ca33a930bcd0d5ffb (diff)
downloademacs-5d22135b02c94cb9f75dc2458480c6065d48608c.tar.gz
emacs-5d22135b02c94cb9f75dc2458480c6065d48608c.zip
Patch of Alan Shutko <ats@acm.org> by way of rms.
(diary-face): New. (european-calendar-display-form, describe-calendar-mode) (mark-visible-calendar-date, calendar-mark-today): Tidy doc string. (calendar-make-alist): New. (calendar-mode): Set up font-lock mode. (generate-calendar-window): Fontify if font-lock-mode is on.
-rw-r--r--lisp/ChangeLog18
-rw-r--r--lisp/calendar/calendar.el35
2 files changed, 48 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c928692485c..48b4f5132c2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,21 @@
12002-08-23 Alan Shutko <ats@acm.org>
2
3 * calendar/diary-lib.el (list-diary-entries): Pass a marker
4 indicating source of entry to add-to-diary-list.
5 (diary-button-face, diary-entry, diary-goto-entry): New, to
6 support click to diary file.
7 (fancy-diary-display): Buttonize diary entries.
8 (list-sexp-diary-entries): Pass a marker indicating source of
9 entry to add-to-diary-list.
10 (diary-date): Return mark as well as entry.
11
12 * calendar/calendar.el (diary-face): New.
13 (european-calendar-display-form, describe-calendar-mode)
14 (mark-visible-calendar-date, calendar-mark-today): Tidy doc string.
15 (calendar-make-alist): New.
16 (calendar-mode): Set up font-lock mode.
17 (generate-calendar-window): Fontify if font-lock-mode is on.
18
12002-11-16 Ivan Zakharyaschev <imz@altlinux.org> (tiny change) 192002-11-16 Ivan Zakharyaschev <imz@altlinux.org> (tiny change)
2 20
3 * international/codepage.el (cp866-decode-table): Fix the 21 * international/codepage.el (cp866-decode-table): Fix the
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 2b0f6fe1e3b..e108ef755c3 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -205,6 +205,8 @@ If nil, make an icon of the frame. If non-nil, delete the frame."
205 :group 'view) 205 :group 'view)
206 206
207(add-to-list 'facemenu-unlisted-faces 'diary-face) 207(add-to-list 'facemenu-unlisted-faces 'diary-face)
208(defvar diary-face 'diary-face
209 "Face name to use for diary entries.")
208(defface diary-face 210(defface diary-face
209 '((((class color) (background light)) 211 '((((class color) (background light))
210 :foreground "red") 212 :foreground "red")
@@ -605,7 +607,7 @@ a portion of the first word of the diary entry."
605(defcustom european-calendar-display-form 607(defcustom european-calendar-display-form
606 '((if dayname (concat dayname ", ")) day " " monthname " " year) 608 '((if dayname (concat dayname ", ")) day " " monthname " " year)
607 "*Pseudo-pattern governing the way a date appears in the European style. 609 "*Pseudo-pattern governing the way a date appears in the European style.
608See the documentation of calendar-date-display-form for an explanation." 610See the documentation of `calendar-date-display-form' for an explanation."
609 :type 'sexp 611 :type 'sexp
610 :group 'calendar) 612 :group 'calendar)
611 613
@@ -1808,6 +1810,8 @@ Or, for optional MON, YR."
1808 ;; Adjust the window to exactly fit the displayed calendar 1810 ;; Adjust the window to exactly fit the displayed calendar
1809 (fit-window-to-buffer)) 1811 (fit-window-to-buffer))
1810 (sit-for 0) 1812 (sit-for 0)
1813 (if font-lock-mode
1814 (font-lock-fontify-buffer))
1811 (and mark-holidays-in-calendar 1815 (and mark-holidays-in-calendar
1812 (mark-calendar-holidays) 1816 (mark-calendar-holidays)
1813 (sit-for 0)) 1817 (sit-for 0))
@@ -2021,7 +2025,7 @@ the inserted text. Value is always t."
2021 (define-key calendar-mode-map "tY" 'cal-tex-cursor-year-landscape)) 2025 (define-key calendar-mode-map "tY" 'cal-tex-cursor-year-landscape))
2022 2026
2023(defun describe-calendar-mode () 2027(defun describe-calendar-mode ()
2024 "Create a help buffer with a brief description of the calendar-mode." 2028 "Create a help buffer with a brief description of the `calendar-mode'."
2025 (interactive) 2029 (interactive)
2026 (with-output-to-temp-buffer "*Help*" 2030 (with-output-to-temp-buffer "*Help*"
2027 (princ 2031 (princ
@@ -2135,6 +2139,8 @@ with respect to the calendar as well as possible."
2135 (info)) 2139 (info))
2136 (Info-find-node (car (car where)) (car (cdr (car where))))))) 2140 (Info-find-node (car (car where)) (car (cdr (car where)))))))
2137 2141
2142
2143
2138(defun calendar-mode () 2144(defun calendar-mode ()
2139 "A major mode for the calendar window. 2145 "A major mode for the calendar window.
2140 2146
@@ -2153,7 +2159,9 @@ For a complete description, type \
2153 (add-hook 'activate-menubar-hook 'cal-menu-update nil t) 2159 (add-hook 'activate-menubar-hook 'cal-menu-update nil t)
2154 (make-local-variable 'calendar-mark-ring) 2160 (make-local-variable 'calendar-mark-ring)
2155 (make-local-variable 'displayed-month);; Month in middle of window. 2161 (make-local-variable 'displayed-month);; Month in middle of window.
2156 (make-local-variable 'displayed-year));; Year in middle of window. 2162 (make-local-variable 'displayed-year) ;; Year in middle of window.
2163 (set (make-local-variable 'font-lock-defaults)
2164 '(calendar-font-lock-keywords t)))
2157 2165
2158(defun calendar-string-spread (strings char length) 2166(defun calendar-string-spread (strings char length)
2159 "Concatenate list of STRINGS separated with copies of CHAR to fill LENGTH. 2167 "Concatenate list of STRINGS separated with copies of CHAR to fill LENGTH.
@@ -2467,6 +2475,23 @@ rather than a date."
2467 "July" "August" "September" "October" "November" "December"] 2475 "July" "August" "September" "October" "November" "December"]
2468 "Array of capitalized strings giving, in order, the month names.") 2476 "Array of capitalized strings giving, in order, the month names.")
2469 2477
2478(defvar calendar-font-lock-keywords
2479 (list
2480 '("[A-Z][a-z]+ -?[0-9]+" . font-lock-function-name-face) ; month and year
2481 (cons
2482 (concat (substring (aref calendar-day-name-array 6) 0 2)
2483 "\\|"
2484 (substring (aref calendar-day-name-array 0) 0 2))
2485 'font-lock-comment-face)
2486 (cons
2487 (mapconcat 'identity
2488 (mapcar '(lambda (x) (substring x 0 2))
2489 calendar-day-name-array)
2490 "\\|")
2491 'font-lock-reference-face))
2492 "Default keywords to highlight in Calendar mode.")
2493
2494
2470(defun calendar-make-alist (sequence &optional start-index filter) 2495(defun calendar-make-alist (sequence &optional start-index filter)
2471 "Make an assoc list corresponding to SEQUENCE. 2496 "Make an assoc list corresponding to SEQUENCE.
2472Start at index 1, unless optional START-INDEX is provided. 2497Start at index 1, unless optional START-INDEX is provided.
@@ -2530,7 +2555,7 @@ If WIDTH is non-nil, return just the first WIDTH characters of the name."
2530(defun mark-visible-calendar-date (date &optional mark) 2555(defun mark-visible-calendar-date (date &optional mark)
2531 "Mark DATE in the calendar window with MARK. 2556 "Mark DATE in the calendar window with MARK.
2532MARK is either a single-character string or a face. 2557MARK is either a single-character string or a face.
2533MARK defaults to diary-entry-marker." 2558MARK defaults to `diary-entry-marker'."
2534 (if (calendar-date-is-legal-p date) 2559 (if (calendar-date-is-legal-p date)
2535 (save-excursion 2560 (save-excursion
2536 (set-buffer calendar-buffer) 2561 (set-buffer calendar-buffer)
@@ -2562,7 +2587,7 @@ calendar window has been prepared."
2562 2587
2563(defun calendar-mark-today () 2588(defun calendar-mark-today ()
2564 "Mark the date under the cursor in the calendar window. 2589 "Mark the date under the cursor in the calendar window.
2565The date is marked with calendar-today-marker. This function can be used with 2590The date is marked with `calendar-today-marker'. This function can be used with
2566the `today-visible-calendar-hook' run after the calendar window has been 2591the `today-visible-calendar-hook' run after the calendar window has been
2567prepared." 2592prepared."
2568 (mark-visible-calendar-date 2593 (mark-visible-calendar-date