aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1999-08-28 15:20:18 +0000
committerRichard M. Stallman1999-08-28 15:20:18 +0000
commitd2e8c33b88472979d01ff85fe8f69148f2adddf7 (patch)
tree8c0d214d360892b63bbf1b3c6612daccbe8ac92d
parent5c9705e5a99642975a100a8123a97b56aafbc91c (diff)
downloademacs-d2e8c33b88472979d01ff85fe8f69148f2adddf7.tar.gz
emacs-d2e8c33b88472979d01ff85fe8f69148f2adddf7.zip
Call the new hook in every movement function.
-rw-r--r--lisp/calendar/cal-move.el30
1 files changed, 20 insertions, 10 deletions
diff --git a/lisp/calendar/cal-move.el b/lisp/calendar/cal-move.el
index 2bf6a0a4957..c7d163982ac 100644
--- a/lisp/calendar/cal-move.el
+++ b/lisp/calendar/cal-move.el
@@ -45,7 +45,8 @@
45 (if (not (calendar-date-is-visible-p today)) 45 (if (not (calendar-date-is-visible-p today))
46 (generate-calendar-window) 46 (generate-calendar-window)
47 (update-calendar-mode-line) 47 (update-calendar-mode-line)
48 (calendar-cursor-to-visible-date today)))) 48 (calendar-cursor-to-visible-date today)))
49 (run-hooks 'calendar-move-hook))
49 50
50(defun calendar-forward-month (arg) 51(defun calendar-forward-month (arg)
51 "Move the cursor forward ARG months. 52 "Move the cursor forward ARG months.
@@ -64,7 +65,8 @@ Movement is backward if ARG is negative."
64 (let ((new-cursor-date (list month day year))) 65 (let ((new-cursor-date (list month day year)))
65 (if (not (calendar-date-is-visible-p new-cursor-date)) 66 (if (not (calendar-date-is-visible-p new-cursor-date))
66 (calendar-other-month month year)) 67 (calendar-other-month month year))
67 (calendar-cursor-to-visible-date new-cursor-date)))) 68 (calendar-cursor-to-visible-date new-cursor-date)))
69 (run-hooks 'calendar-move-hook))
68 70
69(defun calendar-forward-year (arg) 71(defun calendar-forward-year (arg)
70 "Move the cursor forward by ARG years. 72 "Move the cursor forward by ARG years.
@@ -101,7 +103,8 @@ position of the cursor with respect to the calendar as well as possible."
101 (cond 103 (cond
102 ((calendar-date-is-visible-p old-date) old-date) 104 ((calendar-date-is-visible-p old-date) old-date)
103 ((calendar-date-is-visible-p today) today) 105 ((calendar-date-is-visible-p today) today)
104 (t (list month 1 year)))))))) 106 (t (list month 1 year)))))))
107 (run-hooks 'calendar-move-hook))
105 108
106(defun scroll-calendar-right (arg) 109(defun scroll-calendar-right (arg)
107 "Scroll the displayed calendar window right by ARG months. 110 "Scroll the displayed calendar window right by ARG months.
@@ -168,7 +171,8 @@ Moves backward if ARG is negative."
168 ;; Put the new month on the screen, if needed, and go to the new date. 171 ;; Put the new month on the screen, if needed, and go to the new date.
169 (if (not (calendar-date-is-visible-p new-cursor-date)) 172 (if (not (calendar-date-is-visible-p new-cursor-date))
170 (calendar-other-month new-display-month new-display-year)) 173 (calendar-other-month new-display-month new-display-year))
171 (calendar-cursor-to-visible-date new-cursor-date)))) 174 (calendar-cursor-to-visible-date new-cursor-date)))
175 (run-hooks 'calendar-move-hook))
172 176
173(defun calendar-backward-day (arg) 177(defun calendar-backward-day (arg)
174 "Move the cursor back ARG days. 178 "Move the cursor back ARG days.
@@ -243,7 +247,8 @@ Moves forward if ARG is negative."
243 year))) 247 year)))
244 (if (not (calendar-date-is-visible-p last-day)) 248 (if (not (calendar-date-is-visible-p last-day))
245 (calendar-other-month month year) 249 (calendar-other-month month year)
246 (calendar-cursor-to-visible-date last-day))))) 250 (calendar-cursor-to-visible-date last-day))))
251 (run-hooks 'calendar-move-hook))
247 252
248(defun calendar-beginning-of-year (arg) 253(defun calendar-beginning-of-year (arg)
249 "Move the cursor backward ARG year beginnings." 254 "Move the cursor backward ARG year beginnings."
@@ -253,13 +258,15 @@ Moves forward if ARG is negative."
253 (month (extract-calendar-month date)) 258 (month (extract-calendar-month date))
254 (day (extract-calendar-day date)) 259 (day (extract-calendar-day date))
255 (year (extract-calendar-year date)) 260 (year (extract-calendar-year date))
256 (jan-first (list 1 1 year))) 261 (jan-first (list 1 1 year))
262 (calendar-move-hook nil))
257 (if (and (= day 1) (= 1 month)) 263 (if (and (= day 1) (= 1 month))
258 (calendar-backward-month (* 12 arg)) 264 (calendar-backward-month (* 12 arg))
259 (if (and (= arg 1) 265 (if (and (= arg 1)
260 (calendar-date-is-visible-p jan-first)) 266 (calendar-date-is-visible-p jan-first))
261 (calendar-cursor-to-visible-date jan-first) 267 (calendar-cursor-to-visible-date jan-first)
262 (calendar-other-month 1 (- year (1- arg))))))) 268 (calendar-other-month 1 (- year (1- arg))))))
269 (run-hooks 'calendar-move-hook))
263 270
264(defun calendar-end-of-year (arg) 271(defun calendar-end-of-year (arg)
265 "Move the cursor forward ARG year beginnings." 272 "Move the cursor forward ARG year beginnings."
@@ -269,14 +276,16 @@ Moves forward if ARG is negative."
269 (month (extract-calendar-month date)) 276 (month (extract-calendar-month date))
270 (day (extract-calendar-day date)) 277 (day (extract-calendar-day date))
271 (year (extract-calendar-year date)) 278 (year (extract-calendar-year date))
272 (dec-31 (list 12 31 year))) 279 (dec-31 (list 12 31 year))
280 (calendar-move-hook nil))
273 (if (and (= day 31) (= 12 month)) 281 (if (and (= day 31) (= 12 month))
274 (calendar-forward-month (* 12 arg)) 282 (calendar-forward-month (* 12 arg))
275 (if (and (= arg 1) 283 (if (and (= arg 1)
276 (calendar-date-is-visible-p dec-31)) 284 (calendar-date-is-visible-p dec-31))
277 (calendar-cursor-to-visible-date dec-31) 285 (calendar-cursor-to-visible-date dec-31)
278 (calendar-other-month 12 (- year (1- arg))) 286 (calendar-other-month 12 (- year (1- arg)))
279 (calendar-cursor-to-visible-date (list 12 31 displayed-year)))))) 287 (calendar-cursor-to-visible-date (list 12 31 displayed-year)))))
288 (run-hooks 'calendar-move-hook))
280 289
281(defun calendar-cursor-to-visible-date (date) 290(defun calendar-cursor-to-visible-date (date)
282 "Move the cursor to DATE that is on the screen." 291 "Move the cursor to DATE that is on the screen."
@@ -311,7 +320,8 @@ Moves forward if ARG is negative."
311 2 320 2
312 month) 321 month)
313 year))) 322 year)))
314 (calendar-cursor-to-visible-date date)) 323 (calendar-cursor-to-visible-date date)
324 (run-hooks 'calendar-move-hook))
315 325
316(provide 'cal-move) 326(provide 'cal-move)
317 327