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 378464196F3 for ; Wed, 14 Apr 2010 10:50:53 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.5 X-Spam-Level: X-Spam-Status: No, score=-1.5 tagged_above=-999 required=5 tests=[BAYES_50=0.8, RCVD_IN_DNSWL_MED=-2.3] 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 CeGhl3wqJuOZ for ; Wed, 14 Apr 2010 10:50:52 -0700 (PDT) Received: from ipex2.johnshopkins.edu (ipex2.johnshopkins.edu [162.129.8.151]) by olra.theworths.org (Postfix) with ESMTP id 2BD6A431FC1 for ; Wed, 14 Apr 2010 10:50:52 -0700 (PDT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEACydxUuA3DZF/2dsb2JhbACbVXG0c4hdhQ0E X-IronPort-AV: E=Sophos;i="4.52,205,1270440000"; d="scan'208";a="321351554" Received: from watt.gilman.jhu.edu ([128.220.54.69]) by ipex2.johnshopkins.edu with ESMTP/TLS/ADH-AES256-SHA; 14 Apr 2010 13:50:51 -0400 Received: by watt.gilman.jhu.edu (Postfix, from userid 502) id 265DB4973B0; Wed, 14 Apr 2010 13:50:50 -0400 (EDT) From: Jesse Rosenthal To: Carl Worth , notmuch@notmuchmail.org Subject: Re: [PATCH] Fix bug, and clean up code duplication, in adding or removing tag by region. In-Reply-To: <87zl16ez21.fsf@yoom.home.cworth.org> 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> <87zl16ez21.fsf@yoom.home.cworth.org> Date: Wed, 14 Apr 2010 13:50:50 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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:50:53 -0000 On Wed, 14 Apr 2010 10:14:46 -0700, Carl Worth wrote: > 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). I was a bit worried about that myself. I hard-coded the 2 based on the hard-coding in `notmuch-search-last-thread' (">"), which currently goes to the bottom and then goes up two lines. But it seems like if there were a more robust approach, it could be used in both. > 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. It occurs to me that the best way to do this would probably be to go to point-max, and then (forward-line -1) until we hit a thread-id. That way we wouldn't have to work all the way down long search indexes. I'll try to code that up for the next release, and then have notmuch-search-last-thread use it, as well as the region functions. Best, Jesse