changeset 25411:0d68ae69cd8c

Call the new hook in every movement function.
author Richard M. Stallman <rms@gnu.org>
date Sat, 28 Aug 1999 15:20:18 +0000
parents 3ab4413f7549
children 27c66621737f
files lisp/calendar/cal-move.el
diffstat 1 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/cal-move.el	Sat Aug 28 15:18:39 1999 +0000
+++ b/lisp/calendar/cal-move.el	Sat Aug 28 15:20:18 1999 +0000
@@ -45,7 +45,8 @@
     (if (not (calendar-date-is-visible-p today))
         (generate-calendar-window)
       (update-calendar-mode-line)
-      (calendar-cursor-to-visible-date today))))
+      (calendar-cursor-to-visible-date today)))
+  (run-hooks 'calendar-move-hook))
 
 (defun calendar-forward-month (arg)
   "Move the cursor forward ARG months.
@@ -64,7 +65,8 @@
     (let ((new-cursor-date (list month day year)))
       (if (not (calendar-date-is-visible-p new-cursor-date))
           (calendar-other-month month year))
-      (calendar-cursor-to-visible-date new-cursor-date))))
+      (calendar-cursor-to-visible-date new-cursor-date)))
+  (run-hooks 'calendar-move-hook))
 
 (defun calendar-forward-year (arg)
   "Move the cursor forward by ARG years.
@@ -101,7 +103,8 @@
            (cond
             ((calendar-date-is-visible-p old-date) old-date)
             ((calendar-date-is-visible-p today) today)
-            (t (list month 1 year))))))))
+            (t (list month 1 year)))))))
+  (run-hooks 'calendar-move-hook))
 
 (defun scroll-calendar-right (arg)
   "Scroll the displayed calendar window right by ARG months.
@@ -168,7 +171,8 @@
         ;; Put the new month on the screen, if needed, and go to the new date.
         (if (not (calendar-date-is-visible-p new-cursor-date))
             (calendar-other-month new-display-month new-display-year))
-        (calendar-cursor-to-visible-date new-cursor-date))))
+        (calendar-cursor-to-visible-date new-cursor-date)))
+  (run-hooks 'calendar-move-hook))
 
 (defun calendar-backward-day (arg)
   "Move the cursor back ARG days.
@@ -243,7 +247,8 @@
                      year)))
       (if (not (calendar-date-is-visible-p last-day))
           (calendar-other-month month year)
-      (calendar-cursor-to-visible-date last-day)))))
+      (calendar-cursor-to-visible-date last-day))))
+  (run-hooks 'calendar-move-hook))
 
 (defun calendar-beginning-of-year (arg)
   "Move the cursor backward ARG year beginnings."
@@ -253,13 +258,15 @@
          (month (extract-calendar-month date))
          (day (extract-calendar-day date))
          (year (extract-calendar-year date))
-         (jan-first (list 1 1 year)))
+         (jan-first (list 1 1 year))
+         (calendar-move-hook nil))
     (if (and (= day 1) (= 1 month))
         (calendar-backward-month (* 12 arg))
       (if (and (= arg 1)
                (calendar-date-is-visible-p jan-first))
           (calendar-cursor-to-visible-date jan-first)
-        (calendar-other-month 1 (- year (1- arg)))))))
+        (calendar-other-month 1 (- year (1- arg))))))
+  (run-hooks 'calendar-move-hook))
 
 (defun calendar-end-of-year (arg)
   "Move the cursor forward ARG year beginnings."
@@ -269,14 +276,16 @@
          (month (extract-calendar-month date))
          (day (extract-calendar-day date))
          (year (extract-calendar-year date))
-         (dec-31 (list 12 31 year)))
+         (dec-31 (list 12 31 year))
+         (calendar-move-hook nil))
     (if (and (= day 31) (= 12 month))
         (calendar-forward-month (* 12 arg))
       (if (and (= arg 1)
                (calendar-date-is-visible-p dec-31))
           (calendar-cursor-to-visible-date dec-31)
         (calendar-other-month 12 (- year (1- arg)))
-        (calendar-cursor-to-visible-date (list 12 31 displayed-year))))))
+        (calendar-cursor-to-visible-date (list 12 31 displayed-year)))))
+  (run-hooks 'calendar-move-hook))
 
 (defun calendar-cursor-to-visible-date (date)
   "Move the cursor to DATE that is on the screen."
@@ -311,7 +320,8 @@
              2
            month)
          year)))
-  (calendar-cursor-to-visible-date date))
+  (calendar-cursor-to-visible-date date)
+  (run-hooks 'calendar-move-hook))
 
 (provide 'cal-move)