comparison lisp/calendar/calendar.el @ 47333:79920a7d8018

(mouse-scroll-calendar-left) (mouse-scroll-calendar-right, mouse-calendar-other-month): New commands. (calendar-mode-line-format): Use them.
author Richard M. Stallman <rms@gnu.org>
date Mon, 09 Sep 2002 19:37:19 +0000
parents aefe45855309
children 9dad713d153a
comparison
equal deleted inserted replaced
47332:96475604480c 47333:79920a7d8018
2042 (list 2042 (list
2043 (propertize (substitute-command-keys 2043 (propertize (substitute-command-keys
2044 "\\<calendar-mode-map>\\[scroll-calendar-left]") 2044 "\\<calendar-mode-map>\\[scroll-calendar-left]")
2045 'help-echo "mouse-2: scroll left" 2045 'help-echo "mouse-2: scroll left"
2046 'keymap (make-mode-line-mouse-map 'mouse-2 2046 'keymap (make-mode-line-mouse-map 'mouse-2
2047 #'scroll-calendar-left)) 2047 'mouse-scroll-calendar-left))
2048 "Calendar" 2048 "Calendar"
2049 (concat 2049 (concat
2050 (propertize 2050 (propertize
2051 (substitute-command-keys 2051 (substitute-command-keys
2052 "\\<calendar-mode-map>\\[calendar-goto-info-node] info") 2052 "\\<calendar-mode-map>\\[calendar-goto-info-node] info")
2056 (propertize 2056 (propertize
2057 (substitute-command-keys 2057 (substitute-command-keys
2058 "\\<calendar-mode-map>\\[calendar-other-month] other") 2058 "\\<calendar-mode-map>\\[calendar-other-month] other")
2059 'help-echo "mouse-2: choose another month" 2059 'help-echo "mouse-2: choose another month"
2060 'keymap (make-mode-line-mouse-map 2060 'keymap (make-mode-line-mouse-map
2061 'mouse-2 2061 'mouse-2 'mouse-calendar-other-month))
2062 (lambda ()
2063 (interactive)
2064 (call-interactively
2065 'calendar-other-month))))
2066 "/" 2062 "/"
2067 (propertize 2063 (propertize
2068 (substitute-command-keys 2064 (substitute-command-keys
2069 "\\<calendar-mode-map>\\[calendar-goto-today] today") 2065 "\\<calendar-mode-map>\\[calendar-goto-today] today")
2070 'help-echo "mouse-2: go to today's date" 2066 'help-echo "mouse-2: go to today's date"
2072 '(calendar-date-string (calendar-current-date) t) 2068 '(calendar-date-string (calendar-current-date) t)
2073 (propertize (substitute-command-keys 2069 (propertize (substitute-command-keys
2074 "\\<calendar-mode-map>\\[scroll-calendar-right]") 2070 "\\<calendar-mode-map>\\[scroll-calendar-right]")
2075 'help-echo "mouse-2: scroll right" 2071 'help-echo "mouse-2: scroll right"
2076 'keymap (make-mode-line-mouse-map 2072 'keymap (make-mode-line-mouse-map
2077 'mouse-2 #'scroll-calendar-right))) 2073 'mouse-2 'mouse-scroll-calendar-right)))
2078 "The mode line of the calendar buffer. 2074 "The mode line of the calendar buffer.
2079 2075
2080 This must be a list of items that evaluate to strings--those strings are 2076 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 2077 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' 2078 `date' is available for use as the date under (or near) the cursor; `date'
2099 (format \"ISO week %d of %d\" 2095 (format \"ISO week %d of %d\"
2100 (extract-calendar-month iso-date) 2096 (extract-calendar-month iso-date)
2101 (extract-calendar-year iso-date))) 2097 (extract-calendar-year iso-date)))
2102 \"\")) 2098 \"\"))
2103 ") 2099 ")
2100
2101 (defun mouse-scroll-calendar-left (event)
2102 "Scroll the displayed calendar left by one month.
2103 Maintains the relative position of the cursor
2104 with respect to the calendar as well as possible."
2105 (interactive "e")
2106 (save-selected-window
2107 (select-window (posn-window (event-start event)))
2108 (scroll-calendar-left 1)))
2109
2110 (defun mouse-scroll-calendar-right (event)
2111 "Scroll the displayed calendar right by one month.
2112 Maintains the relative position of the cursor
2113 with respect to the calendar as well as possible."
2114 (interactive "e")
2115 (save-selected-window
2116 (select-window (posn-window (event-start event)))
2117 (scroll-calendar-right 1)))
2118
2119 (defun mouse-calendar-other-month (event)
2120 "Display a three-month calendar centered around a specified month and year."
2121 (interactive "e")
2122 (save-selected-window
2123 (select-window (posn-window (event-start event)))
2124 (call-interactively 'calendar-other-month)))
2104 2125
2105 (defun calendar-goto-info-node () 2126 (defun calendar-goto-info-node ()
2106 "Go to the info node for the calendar." 2127 "Go to the info node for the calendar."
2107 (interactive) 2128 (interactive)
2108 (require 'info) 2129 (require 'info)