I like the planner-zoom.el newly available in 3.41 very much, and
here's some improvements. patch attacked.

 1. According to the planner muse port integration guide, now all
    planner files should have ".muse" extension. The change to
    planner-zoom-regexps make planner-zoom recoganize file names with
    ".muse" or without ".muse"

 2. According to the 3.41 info, "The month to which a week belongs is
    the month in which the first day of the week falls.". "2006.04.01"
    should be in "2006.March.Week4" rather than
    "2006.April.Week1". Because "2006.04.08" is in "2006.April.Week1"
    too and this is confusing. The patch to planner-zoom-up-day take
    week-over-month and week-over-year in to account.

 3. Some more test case for (2)

Wish this is useful. 

======================================================================
--- planner-zoom.el.orig        Wed Jun 28 10:49:24 2006
+++ planner-zoom.el     Mon Jul 10 11:49:51 2006
@@ -98,17 +98,17 @@
   "Regexp matching any month name given in planner-planner-zoom-months.")
 
 (defvar planner-zoom-regexps
-  (list '("^\\([0-9]\\{4\\}\\).Year$"
+  (list '("^\\([0-9]\\{4\\}\\).Year\\(.muse\\)*$"
           . year) ; (year)
-        '("^\\([0-9]\\{4\\}\\).Quarter\\([0-5]\\)$"
+        '("^\\([0-9]\\{4\\}\\).Quarter\\([0-5]\\)\\(.muse\\)*$"
           . quarter) ; (year, quarter)
-        (cons (concat "^\\([0-9]\\{4\\}\\)." planner-zoom-month-regexp "$")
+        (cons (concat "^\\([0-9]\\{4\\}\\)." planner-zoom-month-regexp 
"\\(.muse\\)*$")
               'month) ; (year, month)
         (cons (concat "^\\([0-9]\\{4\\}\\)."
                       planner-zoom-month-regexp
-                      ".Week\\([0-6]\\)$")
+                      ".Week\\([0-6]\\)\\(.muse\\)*$")
               'week); year, month, week
-        '("^\\([0-9]\\{4\\}\\).\\([0-9]\\{1,2\\}\\).\\([0-9]\\{1,2\\}\\)$"
+        
'("^\\([0-9]\\{4\\}\\).\\([0-9]\\{1,2\\}\\).\\([0-9]\\{1,2\\}\\)\\(.muse\\)*$"
           . day)) ; year, month, day
   "Alist of regexps that match names of years, quarters, months,
 weeks, and days.")
@@ -559,10 +559,12 @@
 the string NAME."
   (multiple-value-bind (type year month day) (planner-zoom-parse name 'day)
     (let* ((first-date (calendar-nth-named-day
-                        1 planner-zoom-first-day-of-week month year))
+                        -1 planner-zoom-first-day-of-week month year day))
            (first-day (extract-calendar-day first-date))
-           (week (1+ (/ (- day first-day) 7))))
-      (planner-zoom-string 'week year month week))))
+           (week (1+ (/ first-day 7)))
+          (zoom-month (extract-calendar-month first-date))
+          (zoom-year (extract-calendar-year first-date)))
+      (planner-zoom-string 'week zoom-year zoom-month week))))
 
 (defun planner-zoom-next-day (name num)
   "Return the NUMth day after the one given by the string NAME."
@@ -658,7 +660,9 @@
     (planner-zoom-up-quarter ("2006.Quarter1") "2006.Year")
     (planner-zoom-up-month ("2006.April") "2006.Quarter2")
     (planner-zoom-up-week ("2006.April.Week1") "2006.April")
+    (planner-zoom-up-day ("2006.04.01") "2006.March.Week4")
     (planner-zoom-up-day ("2006.04.10") "2006.April.Week2")
+    (planner-zoom-up-day ("2005.01.01") "2004.December.Week4")
 
     ;(calendar-absolute-from-gregorian (4 30 2006) 732431)
     ;(calendar-absolute-from-gregorian (4 30 2005) 732066)
======================================================================

-- 
Dryice @ http://dryice.name

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/sylvester-response.html

_______________________________________________
Planner-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/planner-el-discuss

Reply via email to