From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= Subject: Re: Adding support for limits and exclusions to iCal recurring events Date: Mon, 22 Jul 2013 16:56:25 +0200 Message-ID: <87y58yprs6.fsf@toke.dk> References: <87ehbaxt33.fsf@toke.dk> <87d2qa6cnh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1HXQ-0007RO-Gm for emacs-orgmode@gnu.org; Mon, 22 Jul 2013 10:56:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1HXM-0004CM-OD for emacs-orgmode@gnu.org; Mon, 22 Jul 2013 10:56:36 -0400 Received: from mail.tohojo.dk ([188.40.53.186]:45764) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1HXM-0004Bt-Eu for emacs-orgmode@gnu.org; Mon, 22 Jul 2013 10:56:32 -0400 In-Reply-To: <87d2qa6cnh.fsf@gmail.com> (Nicolas Goaziou's message of "Mon, 22 Jul 2013 13:45:54 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --==-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Nicolas Goaziou writes: > I think EXCLUDE property is a good idea, but I may be renamed to > ICALENDAR_EXCLUDE until it is also handled by Org Agenda, if it ever > happens. It also needs to be documented in the manual. Handling it in the agenda can be done by an exclusion function. I currently have this in my org-agenda-skip-function-global (along with another function to skip items after their END_DATE): (defun thj/skip-excluded () "Skip agenda items on dates in EXCLUDE property" (when (and (boundp 'date) date) (let ((excluded-string (thj/get-property "EXCLUDE")) exclusions) (when excluded-string (setq exclusions (mapcar (lambda (ex-date-string) (equal date (org-date-to-gregorian (org-parse-time-string ex-date-st= ring)))) (split-string excluded-string ","))) (when (memq t exclusions) (org-end-of-subtree t)))))) (Should probably be updated to use the org native property extraction mechanism, but this predates my discovery of that). > On the other hand, I'm not sure about the END_DATE property. Couldn't > DEADLINE be used for that matter? For example, `repeater-end-date' > could be added to `org-icalendar-use-deadline' possible values. When > this symbol belongs to variable's value and current entry has a > deadline, any timestamps with a repeater get deadline's value as its > END=C2=A0DATE property. > > What do you think? Sure, that would work. Two possible issues spring to mind: 1. Is there any use cases where someone might want a deadline (in its current use) along with an end date? Or some other conflict? 2. Will using the DEADLINE field make it harder to add exclusion from the agenda? (I've never really used the deadline field, so don't know what people normally use it for). >> +(defun org-icalendar-zero-convert-timestamp (timestamp &optional format) >> + "Parse and format an org-formatted timestamp, zeroing the time compon= ent." >> + (let ((time (org-parse-time-string timestamp)) >> + (fmt (or format "%Y%m%dT%H%M%SZ"))) >> + (format-time-string fmt (encode-time 0 0 0 (nth 3 time) (nth 4 time= ) (nth 5 time))))) > > Can't `org-icalendar-convert-timestamp' be used instead? It could, conceivably. However, I couldn't find any functions that would parse a property string into the timestamp format expected by org-icalendar-convert-timestamp, and since I would have to modify that function quite a bit to make it do what I needed (print a UTC timestamp string without taking time zones into account; only the date part is used), I thought it would be easier to just create a new function. The above interpretation of how UTC-strings are used in the exclude parameter may be wrong, btw. Or rather, what I've done with END_DATE here is interpret it purely as a date stamp and ignore the time part. Looking at the iCal RFC (I realise now), that's probably not entirely the right interpretation. However, having the "until" value include a time might lead to unexpected results when END_DATE is set to something close to a repetition value. Calling it END_TIME (or, as above DEADLINE) might get this point across and allow for an interpretation that includes the time part. Which would mean it would make more sense to use the org-icalendar-convert-timestamp at least for the end date. So, how do I parse that from a string? Or perhaps that won't be an issue if using the DEADLINE field since that is already parsed higher up in the chain? *ahem*, sorry if the last part became a bit scatter-brained. :) =2DToke --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQEcBAEBAgAGBQJR7UgZAAoJEENeEGz1+utP/p4H/2ZjUw6eoZtD7FuNcU6qlvr6 +KiZiYmCdBm7Efhy3O2Dd1YmChCCXJ+ETyolHPXcPLNz3RaZZng6o5GXww//nRoZ HAusZV5f3MqhVmE4vhwrH81RZTW4ANPt+YkOc10Hh2XxHXkX6aiS5tRnS7o8Syp2 6MCqxyK55VopdOSwvFz411H+x76OAQEXElqX5450meslW3lSbNk9WuF/dLqyOBmU nkXuco4IB9hh03BjSP+cAOZ3PakaJRY5Zelbyy5A59BUsQCIs4NKaQCkGiCUkLEg PuDRvS2hE5lISj1xTfTPQ74Vcw5u/RS85UaWw9G5e16qEMYV1ivpeaFTnsHTNqY= =0vrt -----END PGP SIGNATURE----- --==-=-=--