comparison lisp/calendar/calendar.el @ 60528:952103a61e35

(redraw-calendar): Preserve point. Reported by Matt Hodges <MPHodges@member.fsf.org>. (calendar-week-start-day): Move after definition of redraw-calendar. Delete buffer test, since redraw-calendar has that now.
author Glenn Morris <rgm@gnu.org>
date Wed, 09 Mar 2005 00:28:22 +0000
parents ae2850fc74dc
children e2cd8a11381a e330fedc9152
comparison
equal deleted inserted replaced
60527:0590353a779b 60528:952103a61e35
141 :group 'calendar) 141 :group 'calendar)
142 142
143 143
144 (defconst calendar-buffer "*Calendar*" 144 (defconst calendar-buffer "*Calendar*"
145 "Name of the buffer used for the calendar.") 145 "Name of the buffer used for the calendar.")
146
147 ;;;###autoload
148 (defcustom calendar-week-start-day 0
149 "*The day of the week on which a week in the calendar begins.
150 0 means Sunday (default), 1 means Monday, and so on.
151
152 If you change this variable directly (without using customize)
153 after starting `calendar', you should call `redraw-calendar' to
154 update the calendar display to reflect the change, otherwise
155 movement commands will not work correctly."
156 :type 'integer
157 :set (lambda (sym val)
158 (set sym val)
159 (let ((buffer (get-buffer calendar-buffer)))
160 (when (buffer-live-p buffer)
161 (with-current-buffer buffer
162 (redraw-calendar)))))
163 :group 'calendar)
164 146
165 ;;;###autoload 147 ;;;###autoload
166 (defcustom calendar-offset 0 148 (defcustom calendar-offset 0
167 "*The offset of the principal month from the center of the calendar window. 149 "*The offset of the principal month from the center of the calendar window.
168 0 means the principal month is in the center (default), -1 means on the left, 150 0 means the principal month is in the center (default), -1 means on the left,
2170 2152
2171 (defun redraw-calendar () 2153 (defun redraw-calendar ()
2172 "Redraw the calendar display, if `calendar-buffer' is live." 2154 "Redraw the calendar display, if `calendar-buffer' is live."
2173 (interactive) 2155 (interactive)
2174 (if (get-buffer calendar-buffer) 2156 (if (get-buffer calendar-buffer)
2175 (with-current-buffer calendar-buffer 2157 (save-excursion
2176 (let ((cursor-date (calendar-cursor-to-nearest-date))) 2158 (with-current-buffer calendar-buffer
2177 (generate-calendar-window displayed-month displayed-year) 2159 (let ((cursor-date (calendar-cursor-to-nearest-date)))
2178 (calendar-cursor-to-visible-date cursor-date))))) 2160 (generate-calendar-window displayed-month displayed-year)
2161 (calendar-cursor-to-visible-date cursor-date))))))
2162
2163 ;;;###autoload
2164 (defcustom calendar-week-start-day 0
2165 "*The day of the week on which a week in the calendar begins.
2166 0 means Sunday (default), 1 means Monday, and so on.
2167
2168 If you change this variable directly (without using customize)
2169 after starting `calendar', you should call `redraw-calendar' to
2170 update the calendar display to reflect the change, otherwise
2171 movement commands will not work correctly."
2172 :type 'integer
2173 :set (lambda (sym val)
2174 (set sym val)
2175 (redraw-calendar))
2176 :group 'calendar)
2179 2177
2180 (defcustom calendar-debug-sexp nil 2178 (defcustom calendar-debug-sexp nil
2181 "*Turn debugging on when evaluating a sexp in the diary or holiday list." 2179 "*Turn debugging on when evaluating a sexp in the diary or holiday list."
2182 :type 'boolean 2180 :type 'boolean
2183 :group 'calendar) 2181 :group 'calendar)