>>>> Michael wrote:
Michael> several moons ago I hacked up calendar mode to display the
Michael> ISO or business weeks within the calendar.
ISO weeks is a good thing. I have been wanting them too. Nice that you
have given it a try.
Michael> Perhaps some kind soul (who has deeper lisp knowledge than I
Michael> have) may find this useful and can do a review of this piece
Michael> of code.
I don't know about deep lisp knowledge but I found one or possibly two
problems when I tried the patch.
======================================================================
* 1 -- The function calendar-iso-from-absolute is not loaded. Added an
autoload for that.
Index: cal-iso.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/calendar/cal-iso.el,v
retrieving revision 1.6
diff -u -r1.6 cal-iso.el
--- cal-iso.el 16 Apr 2007 02:12:25 -0000 1.6
+++ cal-iso.el 21 Jul 2007 22:49:51 -0000
@@ -64,6 +64,7 @@
(* 7 (1- week))
(if (= day 0) 6 (1- day)))))
+;;;###autoload
(defun calendar-iso-from-absolute (date)
"Compute the `ISO commercial date' corresponding to the absolute DATE.
The ISO year corresponds approximately to the Gregorian year, but
weeks
======================================================================
* 2 -- The week numbers are accepted as valid dates causing
insert-diary-entry to behave odd. Should be "Not a valid date" just
as if doing the same on other bad positions in the buffer I think.
This is what I came up with -- Ignore the match if in iso week
columns. Please check and improve. (Partial patch: Just the defun
calendar-insert-indented included.)
Index: calendar.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/calendar/calendar.el,v
retrieving revision 1.16
diff -u -r1.16 calendar.el
--- calendar.el 10 Jul 2007 22:52:24 -0000 1.16
+++ calendar.el 21 Jul 2007 22:49:52 -0000
(defun calendar-insert-indented (string indent &optional newline)
"Insert STRING at column INDENT.
@@ -2614,7 +2644,7 @@
;; changes allowing that to be in another frame.
; (if (not (number-or-marker-p displayed-month))
; nil
- (let* ((segment (/ (current-column) 25))
+ (let* ((segment (/ (current-column) (if calendar-display-iso-week-numbers 26 25)))
(month (% (+ displayed-month segment -1) 12))
(month (if (= 0 month) 12 month))
(year
@@ -2623,7 +2653,9 @@
((and (= 1 month) (= segment 2)) (1+ displayed-year))
(t displayed-year))))
(if (and (looking-at "[ 0-9]?[0-9][^0-9]")
- (< 2 (count-lines (point-min) (point))))
+ (< 2 (count-lines (point-min) (point)))
+ (or (not calendar-display-iso-week-numbers)
+ (> (current-column) (+ 5 (* 26 segment)))))
(save-excursion
(if (not (looking-at " "))
(re-search-backward "[^0-9]"))
Michael> I hope to see it in the calendar package someday.
This patch looks promising for the upstream version of calendar. You
might want to try to get it in there.
Yours
--
%% Mats
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches