From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Ekstrand Subject: Re: Feature request: skip blocked lines in agenda view grid Date: Mon, 20 Oct 2008 21:24:48 -0500 Message-ID: <87wsg2y9an.fsf@elehack.net> References: <873aiuosow.fsf@elehack.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0545572944==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ks7Tr-0001fo-2I for emacs-orgmode@gnu.org; Mon, 20 Oct 2008 23:00:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ks7To-0001fM-BL for emacs-orgmode@gnu.org; Mon, 20 Oct 2008 23:00:22 -0400 Received: from [199.232.76.173] (port=44941 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ks7To-0001fJ-9I for emacs-orgmode@gnu.org; Mon, 20 Oct 2008 23:00:20 -0400 Received: from main.gmane.org ([80.91.229.2]:33545 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ks7Tn-00079U-G4 for emacs-orgmode@gnu.org; Mon, 20 Oct 2008 23:00:19 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Ks7Tm-0003MQ-3L for emacs-orgmode@gnu.org; Tue, 21 Oct 2008 03:00:18 +0000 Received: from elehack.net ([216.243.177.100]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Oct 2008 03:00:18 +0000 Received: from michael by elehack.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Oct 2008 03:00:18 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --===============0545572944== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Transfer-Encoding: quoted-printable Michael Ekstrand writes: > I'd find it quite helpful in reviewing my agenda if there was an option > to skip displaying grid lines which happen in the middle of timed > appointments. Right now, I see the following: > > Saturday 18 October 2008 > 8:00...... ---------------- > 10:00...... ---------------- > 12:00...... ---------------- > 14:00...... ---------------- > 16:00...... ---------------- > Church: 17:30-19:00 Saturday service > 18:00...... ---------------- > master: 19:00...... People over for supper > 20:00...... ---------------- > > If it could optionally and intelligently drop the 18:00 grid line > because there is a previous timed appointment overlapping it, the > resulting display would show me more clearly that I don't have time > between it and the next event. After doing some poking around in the org-mode sources, I found out that the particular behavior described above isn't overly difficult to implement; in fact, half the work is already done (at least in the org-mode in Emacs CVS). The first element of the `org-agenda-time-grid' variable (the time grid options) supports an undocumented option `remove-match' which causes `org-agenda-add-time-grid-maybe' to remove grid lines which exactly correspond to the start time of an event. It is rather trivial to extend this logic to also remove grid lines occluded by the duration of an event. I have implemented this as a defadvice for `org-agenda-add-time-grid-maybe' (I like to implement my org-mode logic changes as defadvice so that they work on top of pristine org-mode and I don't have to keep patches in sync or installed). Code follows, if anyone wants to throw it in their .emacs: (defadvice org-agenda-add-time-grid-maybe (around mde-org-agenda-grid-tweak= ify (list ndays todayp)) (if (member 'remove-match (car org-agenda-time-grid)) (flet ((extract-window (line) (let ((start (get-text-property 1 'time-of-day line)) (dur (get-text-property 1 'duration line))) (cond ((and start dur) (cons start dur)) (start start) (t nil))))) (let* ((windows (delq nil (mapcar 'extract-window list))) (org-agenda-time-grid (list (car org-agenda-time-grid) (cadr org-agenda-time-grid) (remove-if (lambda (time) (find-if (lambda (w) (if (numberp w) (equal w time) (and (>=3D time (car w)) (< time (+ (car w) (cdr w)))))) windows)) (caddr org-agenda-time-grid))))) ad-do-it)) ad-do-it)) (ad-activate 'org-agenda-add-time-grid-maybe) =2D Michael =2D-=20 mouse, n: A device for pointing at the xterm in which you want to type. Confused by the strange files? I cryptographically sign my messages. For more information see . --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkj9PXAACgkQJMBfXHjb5YVYzACeO8WVGBFrB38AmoNhMMSX7a1L qoQAn2mfW53/lNMBOVDvqj+8Set98NDI =tFxm -----END PGP SIGNATURE----- --=-=-=-- --===============0545572944== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0545572944==--