Mercurial > emacs
comparison lisp/calendar/calendar.el @ 44369:72939dbe7b7b
(update-calendar-mode-line): Force mode-line update.
Make date under the cursor available as `date' in
calendar-mode-line-format.
Eval items in calendar-mode-line-format list.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 03 Apr 2002 14:35:52 +0000 |
parents | 97a5caf68c50 |
children | aefe45855309 |
comparison
equal
deleted
inserted
replaced
44368:ceb605d3c4dd | 44369:72939dbe7b7b |
---|---|
567 (defcustom diary-date-forms | 567 (defcustom diary-date-forms |
568 (if european-calendar-style | 568 (if european-calendar-style |
569 european-date-diary-pattern | 569 european-date-diary-pattern |
570 american-date-diary-pattern) | 570 american-date-diary-pattern) |
571 "*List of pseudo-patterns describing the forms of date used in the diary. | 571 "*List of pseudo-patterns describing the forms of date used in the diary. |
572 The patterns on the list must be MUTUALLY EXCLUSIVE and must not match | 572 The patterns on the list must be MUTUALLY EXCLUSIVE and must should not match |
573 any portion of the diary entry itself, just the date component. | 573 any portion of the diary entry itself, just the date component. |
574 | 574 |
575 A pseudo-pattern is a list of regular expressions and the keywords `month', | 575 A pseudo-pattern is a list of regular expressions and the keywords `month', |
576 `day', `year', `monthname', and `dayname'. The keyword `monthname' will | 576 `day', `year', `monthname', and `dayname'. The keyword `monthname' will |
577 match the name of the month, capitalized or not, or its three-letter | 577 match the name of the month, capitalized or not, or its three-letter |
2073 (propertize (substitute-command-keys | 2073 (propertize (substitute-command-keys |
2074 "\\<calendar-mode-map>\\[scroll-calendar-right]") | 2074 "\\<calendar-mode-map>\\[scroll-calendar-right]") |
2075 'help-echo "mouse-2: scroll right" | 2075 'help-echo "mouse-2: scroll right" |
2076 'keymap (make-mode-line-mouse-map | 2076 'keymap (make-mode-line-mouse-map |
2077 'mouse-2 #'scroll-calendar-right))) | 2077 'mouse-2 #'scroll-calendar-right))) |
2078 "The mode line of the calendar buffer.") | 2078 "The mode line of the calendar buffer. |
2079 | |
2080 This must be a list of items that evaluate to strings--those strings are | |
2081 evaluated and concatenated together, evenly separated by blanks. The variable | |
2082 `date' is available for use as the date under (or near) the cursor; `date' | |
2083 defaults to the current date if it is otherwise undefined. Here is an example | |
2084 value that has the Hebrew date, the day number/days reamining in the year, | |
2085 and the ISO week/year numbers in the mode. When calendar-move-hook is set to | |
2086 'update-calendar-mode-line, these mode line shows these values for the date | |
2087 under the cursor: | |
2088 | |
2089 (list | |
2090 \"\" | |
2091 '(calendar-hebrew-date-string date) | |
2092 '(let* ((year (extract-calendar-year date)) | |
2093 (d (calendar-day-number date)) | |
2094 (days-remaining | |
2095 (- (calendar-day-number (list 12 31 year)) d))) | |
2096 (format \"%d/%d\" d days-remaining)) | |
2097 '(let* ((d (calendar-absolute-from-gregorian date)) | |
2098 (iso-date (calendar-iso-from-absolute d))) | |
2099 (format \"ISO week %d of %d\" | |
2100 (extract-calendar-month iso-date) | |
2101 (extract-calendar-year iso-date))) | |
2102 \"\")) | |
2103 ") | |
2079 | 2104 |
2080 (defun calendar-goto-info-node () | 2105 (defun calendar-goto-info-node () |
2081 "Go to the info node for the calendar." | 2106 "Go to the info node for the calendar." |
2082 (interactive) | 2107 (interactive) |
2083 (require 'info) | 2108 (require 'info) |
2140 (if (bufferp (get-buffer calendar-buffer)) | 2165 (if (bufferp (get-buffer calendar-buffer)) |
2141 (save-excursion | 2166 (save-excursion |
2142 (set-buffer calendar-buffer) | 2167 (set-buffer calendar-buffer) |
2143 (setq mode-line-format | 2168 (setq mode-line-format |
2144 (calendar-string-spread | 2169 (calendar-string-spread |
2145 calendar-mode-line-format ? (frame-width)))))) | 2170 (let ((date (condition-case nil |
2171 (calendar-cursor-to-nearest-date) | |
2172 (error (calendar-current-date))))) | |
2173 (mapcar 'eval calendar-mode-line-format)) | |
2174 ? (frame-width))) | |
2175 (force-mode-line-update)))) | |
2146 | 2176 |
2147 (defun calendar-window-list () | 2177 (defun calendar-window-list () |
2148 "List of all calendar-related windows." | 2178 "List of all calendar-related windows." |
2149 (let ((calendar-buffers (calendar-buffer-list)) | 2179 (let ((calendar-buffers (calendar-buffer-list)) |
2150 list) | 2180 list) |