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 E22A24196F2 for ; Wed, 14 Apr 2010 10:14:47 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.89 X-Spam-Level: X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01] autolearn=ham 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 GOKnjVOLVZi2; Wed, 14 Apr 2010 10:14:47 -0700 (PDT) Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id DC699431FC1; Wed, 14 Apr 2010 10:14:46 -0700 (PDT) Received: by yoom.home.cworth.org (Postfix, from userid 1000) id 77A21568DE1; Wed, 14 Apr 2010 10:14:46 -0700 (PDT) From: Carl Worth To: Jesse Rosenthal , notmuch@notmuchmail.org Subject: Re: [PATCH] Fix bug, and clean up code duplication, in adding or removing tag by region. In-Reply-To: <871vejxk94.fsf@jhu.edu> References: <87sk90ragj.fsf@jhu.edu> <87aatfq88h.fsf@yoom.home.cworth.org> <877hogaf7v.fsf@jhu.edu> <878w8rkzis.fsf@yoom.home.cworth.org> <871vejxk94.fsf@jhu.edu> Date: Wed, 14 Apr 2010 10:14:46 -0700 Message-ID: <87zl16ez21.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" 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, 14 Apr 2010 17:14:48 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable On Tue, 13 Apr 2010 14:47:19 -0400, Jesse Rosenthal wr= ote: > There was a bug in notmuch-search-{add,remove}-tag-region, which would > not behave correctly if the region went beyond the last message. Now, > instead of simply iterating to the last line of the region, these > functions will iterate to the minimum of the last line of the region > and the last possible line, i.e. Thanks, Jesse! I tested this and it works great.=20 > (- (line-number-at-pos (point-max)) 2) The only real problem I see with this approach is that it's fragile in depending on the buffer having exactly 2 lines of non-thread text at the end. I can easily see myself wanting to remove the "End of Search Results" line at the end of the buffer. And if I do that, this code will break, (tag manipulations will miss the last message). A more robust fix would check for the ability to read a thread ID. So making a single function such as notmuch-search-find-last-line-with-thread-id or so would do the trick here. > Also clean up code duplication, as per Carl's suggestion, by making > notmuch-search-{add/remove}-tag-thread a special case of the -region > commands, where the region in question is between (point) and (point). A very nice change as well. My internal alarm on "also" in a commit message fired, so I took advantage of "git add -p" and "git rebase -i" to split this portion into a separate commit. All pushed now. =2DCarl --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQFLxfgG6JDdNq8qSWgRAskPAKCmUrMpHQVoF5mremO+cSQWcDAmawCeLsva ohf/fSkNwWCquB018kjrZqY= =sXle -----END PGP SIGNATURE----- --=-=-=--