aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-09-17 17:06:00 +0000
committerDave Love2000-09-17 17:06:00 +0000
commitd4ff5db9b4265bd739b964e5e30f5f0110bbdb0b (patch)
tree88ae5f81cf6f89177352bcb6acd090f1b85e21be
parent53c9ab4f44bb9b91004476a032e59dd0d1ee3fd1 (diff)
downloademacs-d4ff5db9b4265bd739b964e5e30f5f0110bbdb0b.tar.gz
emacs-d4ff5db9b4265bd739b964e5e30f5f0110bbdb0b.zip
(calendar-mode-line-format): Make fields
mouse-sensitive. (calendar-read-date, calendar-read-date, calendar-window-list): Unquote lambda. (calendar-month-name): Use aref, not sref.
-rw-r--r--lisp/calendar/calendar.el50
1 files changed, 41 insertions, 9 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index afeece04328..2b54c62798a 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -93,6 +93,12 @@
93 93
94;;; Code: 94;;; Code:
95 95
96(eval-when-compile
97 (defvar displayed-month)
98 (defvar displayed-year)
99 (defvar calendar-month-name-array)
100 (defvar calendar-starred-day))
101
96(defun calendar-version () 102(defun calendar-version ()
97 (interactive) 103 (interactive)
98 (message "Version 6, October 12, 1995")) 104 (message "Version 6, October 12, 1995"))
@@ -2021,11 +2027,37 @@ the inserted text. Value is always t."
2021 2027
2022(defvar calendar-mode-line-format 2028(defvar calendar-mode-line-format
2023 (list 2029 (list
2024 (substitute-command-keys "\\<calendar-mode-map>\\[scroll-calendar-left]") 2030 (propertize (substitute-command-keys
2031 "\\<calendar-mode-map>\\[scroll-calendar-left]")
2032 'help-echo "mouse-2: scroll left"
2033 'keymap (make-mode-line-mouse2-map #'scroll-calendar-left))
2025 "Calendar" 2034 "Calendar"
2026 (substitute-command-keys "\\<calendar-mode-map>\\[calendar-goto-info-node] info/\\[calendar-other-month] other/\\[calendar-goto-today] today") 2035 (concat
2036 (propertize
2037 (substitute-command-keys
2038 "\\<calendar-mode-map>\\[calendar-goto-info-node] info")
2039 'help-echo "mouse-2: read Info on Calendar"
2040 'keymap (make-mode-line-mouse2-map #'calendar-goto-info-node))
2041 "/"
2042 (propertize
2043 (substitute-command-keys
2044 "\\<calendar-mode-map>\\[calendar-other-month] other")
2045 'help-echo "mouse-2: choose another month"
2046 'keymap (make-mode-line-mouse2-map (lambda ()
2047 (interactive)
2048 (call-interactively
2049 'calendar-other-month))))
2050 "/"
2051 (propertize
2052 (substitute-command-keys
2053 "\\<calendar-mode-map>\\[calendar-goto-today] today")
2054 'help-echo "mouse-2: go to today's date"
2055 'keymap (make-mode-line-mouse2-map #'calendar-goto-today)))
2027 '(calendar-date-string (calendar-current-date) t) 2056 '(calendar-date-string (calendar-current-date) t)
2028 (substitute-command-keys "\\<calendar-mode-map>\\[scroll-calendar-right]")) 2057 (propertize (substitute-command-keys
2058 "\\<calendar-mode-map>\\[scroll-calendar-right]")
2059 'help-echo "mouse-2: scroll right"
2060 'keymap (make-mode-line-mouse2-map #'scroll-calendar-right)))
2029 "The mode line of the calendar buffer.") 2061 "The mode line of the calendar buffer.")
2030 2062
2031(defun calendar-goto-info-node () 2063(defun calendar-goto-info-node ()
@@ -2102,9 +2134,9 @@ the STRINGS are just concatenated and the result truncated."
2102 "List of all calendar-related windows." 2134 "List of all calendar-related windows."
2103 (let ((calendar-buffers (calendar-buffer-list)) 2135 (let ((calendar-buffers (calendar-buffer-list))
2104 list) 2136 list)
2105 (walk-windows '(lambda (w) 2137 (walk-windows (lambda (w)
2106 (if (memq (window-buffer w) calendar-buffers) 2138 (if (memq (window-buffer w) calendar-buffers)
2107 (setq list (cons w list)))) 2139 (setq list (cons w list))))
2108 nil t) 2140 nil t)
2109 list)) 2141 list))
2110 2142
@@ -2324,7 +2356,7 @@ If optional NODAY is t, does not ask for day, but just returns
2324\(month year) " 2356\(month year) "
2325 (let* ((year (calendar-read 2357 (let* ((year (calendar-read
2326 "Year (>0): " 2358 "Year (>0): "
2327 '(lambda (x) (> x 0)) 2359 (lambda (x) (> x 0))
2328 (int-to-string (extract-calendar-year 2360 (int-to-string (extract-calendar-year
2329 (calendar-current-date))))) 2361 (calendar-current-date)))))
2330 (month-array calendar-month-name-array) 2362 (month-array calendar-month-name-array)
@@ -2342,7 +2374,7 @@ If optional NODAY is t, does not ask for day, but just returns
2342 (list month year)) 2374 (list month year))
2343 (list month 2375 (list month
2344 (calendar-read (format "Day (1-%d): " last) 2376 (calendar-read (format "Day (1-%d): " last)
2345 '(lambda (x) (and (< 0 x) (<= x last)))) 2377 (lambda (x) (and (< 0 x) (<= x last))))
2346 year)))) 2378 year))))
2347 2379
2348(defun calendar-interval (mon1 yr1 mon2 yr2) 2380(defun calendar-interval (mon1 yr1 mon2 yr2)
@@ -2389,7 +2421,7 @@ If WIDTH is non-nil, return just the first WIDTH characters of the name."
2389 (if width 2421 (if width
2390 (let ((i 0) (result "") (pos 0)) 2422 (let ((i 0) (result "") (pos 0))
2391 (while (< i width) 2423 (while (< i width)
2392 (let ((chartext (char-to-string (sref string pos)))) 2424 (let ((chartext (char-to-string (aref string pos))))
2393 (setq pos (+ pos (length chartext))) 2425 (setq pos (+ pos (length chartext)))
2394 (setq result (concat result chartext))) 2426 (setq result (concat result chartext)))
2395 (setq i (1+ i))) 2427 (setq i (1+ i)))