Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 128D9431FAE for ; Wed, 6 Jan 2010 01:59:14 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p39VFzq-Hvrw for ; Wed, 6 Jan 2010 01:59:11 -0800 (PST) Received: from flatline.sindominio.net (flatline.sindominio.net [82.144.4.26]) by olra.theworths.org (Postfix) with ESMTP id 8B552431FBC for ; Wed, 6 Jan 2010 01:59:11 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by flatline.sindominio.net (Postfix) with ESMTP id 0D01234802D; Wed, 6 Jan 2010 10:59:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at sindominio.net Received: from flatline.sindominio.net ([127.0.0.1]) by localhost (flatline.sindominio.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a4MiaKrK8HfL; Wed, 6 Jan 2010 10:59:07 +0100 (CET) Received: from blackspot (rpollan-laptop.cern.ch [137.138.192.228]) by flatline.sindominio.net (Postfix) with ESMTPA id C02C6348036; Wed, 6 Jan 2010 10:59:03 +0100 (CET) Received: by blackspot (Postfix, from userid 1000) id A8B688BCC3; Wed, 6 Jan 2010 10:08:54 +0100 (CET) Date: Wed, 6 Jan 2010 10:08:54 +0100 From: Ruben Pollan To: Carl Worth Message-ID: <20100106090854.GA4870@blackspot> References: <20091126202347.GA16654@blackspot> <1260364206-344-1-git-send-email-meskio@sindominio.net> <20091209132446.GC23878@blackspot> <877hsv6hbo.fsf@yoom.home.cworth.org> <87r5qnol78.fsf@yoom.home.cworth.org> <87pr67ofz2.fsf@yoom.home.cworth.org> <20100105153332.GE9339@blackspot> <87637gnxy5.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qDbXVdCdHGoSgWSk" Content-Disposition: inline In-Reply-To: <87637gnxy5.fsf@yoom.home.cworth.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: notmuch@notmuchmail.org Subject: Re: [notmuch] [PATCH] Added regress option to tags iterator X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2010 09:59:14 -0000 --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 11:39, Tue 05 Jan 10, Carl Worth wrote: > Right. So example code using this would be: >=20 > for (notmuch_messages_to_first (messages); > notmuch_messages_has_current (messages); > notmuch_messages_to_next (messages)) > { > notmuch_message_t *message; >=20 > message =3D notmuch_messages_get_current (messages); >=20 > ... > } >=20 > And for iterating in the opposite direction it's very similar: >=20 > for (notmuch_messages_to_last (messages); > notmuch_messages_has_current (messages); > notmuch_messages_to_previous (messages)) > { > notmuch_message_t *message; >=20 > message =3D notmuch_messages_get_current (messages); >=20 > ... > } >=20 > Note that if you couldn't get the iterator to point to an invalid item > before the first, then this second loop would have to look very > different. Yes, make sense like that. I'm not sure what to do about the iterator when is on an invalid item, if y= ou=20 reach an invalid item doing to_next should be possible to do to_previous to= =20 recover the last valid item? Or is better to force the user to use to_last = to=20 go back? In some cases implement to_previous will need to store the previous item=20 (actually I did that on the patches I sent). --=20 Rub=E9n Poll=E1n | jabber:meskio@jabber.org -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D- =C9sta es la historia de una sociedad que se hunde y mientras cae se repite: hasta ahora todo va bien, hasta ahora todo va bien ... Pero lo importante no es la caida sino el aterrizaje. el odio --qDbXVdCdHGoSgWSk Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAktEUyYACgkQGKOQ92SwNMI4hQCfY/KcOb04q1xJ6DOt2KO38XGo VzMAoJlAhsIhigdBF47knDB9YGbKKvfW =cmrR -----END PGP SIGNATURE----- --qDbXVdCdHGoSgWSk--