diff lisp/calendar/cal-menu.el @ 14951:15ab8e95a50a

(calendar-mouse-goto-date): New function. Call it instead of calendar-goto-date throughout this file. (calendar-event-to-date): Switch buffers based on the event.
author Richard M. Stallman <rms@gnu.org>
date Sun, 07 Apr 1996 03:22:54 +0000
parents 5a4b28f19b75
children 47ef84d3738d
line wrap: on
line diff
--- a/lisp/calendar/cal-menu.el	Fri Apr 05 21:08:19 1996 +0000
+++ b/lisp/calendar/cal-menu.el	Sun Apr 07 03:22:54 1996 +0000
@@ -217,6 +217,7 @@
 If event is not on a specific date, signals an error if optional parameter
 ERROR is t, otherwise just returns nil."
   (save-excursion
+    (set-buffer (window-buffer (posn-window (event-start last-input-event))))
     (goto-char (posn-point (event-start last-input-event)))
     (calendar-cursor-to-date error)))
 
@@ -250,49 +251,49 @@
   "Show sunrise/sunset times for mouse-selected date."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (calendar-sunrise-sunset)))
 
 (defun calendar-mouse-holidays ()
   "Show holidays for mouse-selected date."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (calendar-cursor-holidays)))
 
 (defun calendar-mouse-view-diary-entries ()
   "View diary entries on mouse-selected date."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (view-diary-entries 1)))
 
 (defun calendar-mouse-view-other-diary-entries ()
   "View diary entries from alternative file on mouse-selected date."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (call-interactively 'view-other-diary-entries)))
 
 (defun calendar-mouse-insert-diary-entry ()
   "Insert diary entry for mouse-selected date."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (insert-diary-entry nil)))
 
 (defun calendar-mouse-set-mark ()
   "Mark the date under the cursor."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (calendar-set-mark nil)))
 
 (defun cal-tex-mouse-day ()
   "Make a buffer with LaTeX commands for the day mouse is on."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-day nil)))
 
 (defun cal-tex-mouse-week ()
@@ -300,7 +301,7 @@
 Holidays are included if `cal-tex-holidays' is t."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-week nil)))
 
 (defun cal-tex-mouse-week2 ()
@@ -308,7 +309,7 @@
 The printed output will be on two pages."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-week2 nil)))
 
 (defun cal-tex-mouse-week-iso ()
@@ -316,28 +317,28 @@
 Holidays are included if `cal-tex-holidays' is t."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-week-iso nil)))
 
 (defun cal-tex-mouse-week-monday ()
   "One page calendar for week indicated by cursor."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-week-monday nil)))
 
 (defun cal-tex-mouse-filofax-2week ()
   "One page Filofax calendar for week indicated by cursor."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-filofax-2week nil)))
 
 (defun cal-tex-mouse-filofax-week ()
   "Two page Filofax calendar for week indicated by cursor."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-filofax-week nil)))
 
 (defun cal-tex-mouse-month ()
@@ -345,7 +346,7 @@
 Calendar is condensed onto one page."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-month nil)))
 
 (defun cal-tex-mouse-month-landscape ()
@@ -353,28 +354,28 @@
 The output is in landscape format, one month to a page."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-month-landscape nil)))
 
 (defun cal-tex-mouse-year ()
   "Make a buffer with LaTeX commands for the year cursor is on."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-year nil)))
 
 (defun cal-tex-mouse-filofax-year ()
   "Make a buffer with LaTeX commands for Filofax calendar of year cursor is on."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-filofax-year nil)))
 
 (defun cal-tex-mouse-year-landscape ()
   "Make a buffer with LaTeX commands for the year cursor is on."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (cal-tex-cursor-year-landscape nil)))
 
 (defun calendar-mouse-print-dates ()
@@ -427,9 +428,13 @@
   "Show Chinese equivalent for mouse-selected date."
   (interactive)
   (save-excursion
-    (calendar-goto-date (calendar-event-to-date))
+    (calendar-mouse-goto-date (calendar-event-to-date))
     (calendar-print-chinese-date)))
 
+(defun calendar-mouse-goto-date (date)
+  (set-buffer (window-buffer (posn-window (event-start last-input-event))))
+  (calendar-goto-date date))
+
 (defun calendar-mouse-2-date-menu (event)
   "Pop up menu for Mouse-2 for selected date in the calendar window."
   (interactive "e")