Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: calendar: repeated events from ages ago
- X-seq: zsh-workers 26075
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: PATCH: calendar: repeated events from ages ago
- Date: Thu, 20 Nov 2008 16:52:47 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Now that I've noticed this is lying around...
Repeated events in calendar entries (RPT keyword) are always updated
precisely once, not until they are in the future. This fixes that, but
it does it the obvious way so if you're repeating events started a
really long time ago this will take a while.
Lightly tested but unlikely to be further tested until it fails horribly.
Index: Functions/Calendar/calendar_parse
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Calendar/calendar_parse,v
retrieving revision 1.1
diff -u -r1.1 calendar_parse
--- Functions/Calendar/calendar_parse 29 Nov 2007 09:49:43 -0000 1.1
+++ Functions/Calendar/calendar_parse 20 Nov 2008 16:49:36 -0000
@@ -28,6 +28,7 @@
local REPLY REPLY2
local -a match mbegin mend
+integer now
autoload -U calendar_scandate
@@ -70,6 +71,17 @@
reply[rpttime]=$REPLY
reply[rptstr]=${match[2]%%"$REPLY2"}
reply[text2]="${match[1]}${REPLY2##[[:space:]]#}"
+ (( now = EPOCHSECONDS ))
+ while (( ${reply[rpttime]} < now )); do
+ # let's hope the original appointment wasn't in 44 B.C.
+ if calendar_scandate -a -R ${reply[rpttime]} ${reply[rptstr]}; then
+ if (( REPLY <= ${reply[rpttime]} )); then
+ # pathological case
+ break;
+ fi
+ reply[rpttime]=$REPLY
+ fi
+ done
else
# Just remove the keyword for further parsing
reply[text2]="${match[1]}${match[2]##[[:space:]]#}"
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author