emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/calendar holidays.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp/calendar holidays.el
Date: Sat, 10 Jan 2009 22:00:16 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/01/10 22:00:16

Modified files:
        lisp/calendar  : holidays.el 

Log message:
        (calendar-list-holidays, calendar-mark-holidays): Add event handling,
        for when called from menus with the calendar buffer not current.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/calendar/holidays.el?cvsroot=emacs&r1=1.85&r2=1.86

Patches:
Index: holidays.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/holidays.el,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- holidays.el 5 Jan 2009 03:20:39 -0000       1.85
+++ holidays.el 10 Jan 2009 22:00:14 -0000      1.86
@@ -463,11 +463,17 @@
 
 ;; FIXME name that makes sense
 ;;;###cal-autoload
-(defun calendar-list-holidays ()
+(defun calendar-list-holidays (&optional event)
   "Create a buffer containing the holidays for the current calendar window.
 The holidays are those in the list `calendar-notable-days'.
-Returns non-nil if any holidays are found."
-  (interactive)
+Returns non-nil if any holidays are found.
+If EVENT is non-nil, it's an event indicating the buffer position to
+use instead of point."
+  (interactive (list last-nonmenu-event))
+  ;; If called from a menu, with the calendar window not selected.
+  (with-current-buffer
+      (if event (window-buffer (posn-window (event-start event)))
+        (current-buffer))
   (message "Looking up holidays...")
   (let ((holiday-list (calendar-holiday-list))
         (m1 displayed-month)
@@ -491,7 +497,7 @@
                               ": " (cadr x)))
           holiday-list "\n")))
       (message "Looking up holidays...done"))
-    holiday-list))
+      holiday-list)))
 
 (define-obsolete-function-alias
   'list-calendar-holidays 'calendar-list-holidays "23.1")
@@ -658,14 +664,20 @@
 
 ;; FIXME move to calendar?
 ;;;###cal-autoload
-(defun calendar-mark-holidays ()
-  "Mark notable days in the calendar window."
-  (interactive)
+(defun calendar-mark-holidays (&optional event)
+  "Mark notable days in the calendar window.
+If EVENT is non-nil, it's an event indicating the buffer position to
+use instead of point."
+  (interactive (list last-nonmenu-event))
+  ;; If called from a menu, with the calendar window not selected.
+  (with-current-buffer
+      (if event (window-buffer (posn-window (event-start event)))
+        (current-buffer))
   (setq calendar-mark-holidays-flag t)
   (message "Marking holidays...")
   (dolist (holiday (calendar-holiday-list))
     (calendar-mark-visible-date (car holiday) calendar-holiday-marker))
-  (message "Marking holidays...done"))
+    (message "Marking holidays...done")))
 
 (define-obsolete-function-alias
   'mark-calendar-holidays 'calendar-mark-holidays "23.1")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]