emacs-diffs
[Top][All Lists]
Advanced

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

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


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

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

Modified files:
        lisp/calendar  : lunar.el 

Log message:
        (calendar-lunar-phases): 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/lunar.el?cvsroot=emacs&r1=1.45&r2=1.46

Patches:
Index: lunar.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/lunar.el,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- lunar.el    5 Jan 2009 03:20:40 -0000       1.45
+++ lunar.el    10 Jan 2009 22:00:33 -0000      1.46
@@ -178,9 +178,15 @@
 (defvar displayed-year)
 
 ;;;###cal-autoload
-(defun calendar-lunar-phases ()
-  "Create a buffer with the lunar phases for the current calendar window."
-  (interactive)
+(defun calendar-lunar-phases (&optional event)
+  "Create a buffer with the lunar phases for the current 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))
   (message "Computing phases of the moon...")
   (let ((m1 displayed-month)
         (y1 displayed-year)
@@ -207,7 +213,7 @@
                     " "
                     time)))
         (lunar-phase-list m1 y1) "\n")))
-    (message "Computing phases of the moon...done")))
+      (message "Computing phases of the moon...done"))))
 
 ;;;###cal-autoload
 (define-obsolete-function-alias 'calendar-phases-of-moon




reply via email to

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