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 D3CCE431FB6 for ; Fri, 13 Jul 2012 10:53:56 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled 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 Fq57R2QbM9S6 for ; Fri, 13 Jul 2012 10:53:56 -0700 (PDT) Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU [18.7.68.34]) by olra.theworths.org (Postfix) with ESMTP id 371BC431FAE for ; Fri, 13 Jul 2012 10:53:56 -0700 (PDT) X-AuditID: 12074422-b7f1f6d00000090b-b9-500060b3768b Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id AC.E1.02315.3B060005; Fri, 13 Jul 2012 13:53:55 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q6DHrswJ000707; Fri, 13 Jul 2012 13:53:55 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6DHrr8D009890 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 13 Jul 2012 13:53:54 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1Spk3s-000866-Uu; Fri, 13 Jul 2012 13:53:53 -0400 Date: Fri, 13 Jul 2012 13:53:52 -0400 From: Austin Clements To: Mark Walters Subject: Re: [PATCH 7/7] emacs: Fix navigation of multi-line search result formats Message-ID: <20120713175352.GN7332@mit.edu> References: <1342140319-19859-1-git-send-email-amdragon@mit.edu> <1342140319-19859-8-git-send-email-amdragon@mit.edu> <871ukfshjd.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871ukfshjd.fsf@qmul.ac.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42IRYrdT192cwBBgsGqOisXquTwW12/OZHZg 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mjo2fmcueCRaseXtfOYGxn7BLkZODgkBE4n5 /04xQthiEhfurWcDsYUE9jFKXFsl0cXIBWRvYJS41NHKDOGcZJLYu3UBlLOEUaLlwRlmkBYW AVWJLTNWsIPYbAIaEtv2LwcbKyKgI3H70AKwOLOAtMS3381MXYwcHMICIRIrbnKDhHkFtCXW HfnNCjFzKqPElw6QGpCEoMTJmU9YIHq1JG78ewnWCzJn+T8OkDAn0Kp5vyaClYsKqEhMObmN bQKj0Cwk3bOQdM9C6F7AyLyKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI11QvN7NELzWldBMjOKhd lHYw/jyodIhRgINRiYc32Z8hQIg1say4MvcQoyQHk5Ior2Y8UIgvKT+lMiOxOCO+qDQntfgQ owQHs5IIr44xUI43JbGyKrUoHyYlzcGiJM57LeWmv5BAemJJanZqakFqEUxWhoNDSYJXBhi9 QoJFqempFWmZOSUIaSYOTpDhPEDDuUBqeIsLEnOLM9Mh8qcYdTmuPbx1i1GIJS8/L1VKnJcF pEgApCijNA9uDiwZvWIUB3pLmFcYpIoHmMjgJr0CWsIEtGTWz3/+QEtKEhFSUg2MVXuC6mPN eu/f8fFO1IiYfkbFzXeZk+29DzkmP/VNDu9Odn6wfubF7fs8l0eL35bt7/Ax2yNcMCH52J82 bdu9Txe4FS1P/B4mu+fr6RNRsRmPJuxVanksHak2ffYdrUqdf2VteW+d7ZUtrSefNQ/tddlr vzJYfP3//HWzXv1b8nOBWUrhlPmeSizFGYmGWsxFxYkA6TFYVyEDAAA= Cc: notmuch@notmuchmail.org 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: Fri, 13 Jul 2012 17:53:57 -0000 Quoth Mark Walters on Jul 13 at 6:21 pm: > On Fri, 13 Jul 2012, Austin Clements wrote: > > At this point, the only remaining functions that don't support > > multi-line search result formats are the thread navigation functions. > > This patch fixes that by rewriting them in terms of > > notmuch-search-result-{beginning,end}. > > This seems to subtly change the behaviour in the normal case of a single > line result. If point is not at the start of a search result then > notmuch-search-previous-thread moves to the start of the current thread > rather than the previous thread. Is that deliberate? > > As far as I can see show uses p to move to the start of the previous > message so this behaviour is different from there as well. > > I think your choice may be the nicest one (and actually even more so in > show) but thought I would mention it anyway. Oh, yes, that's true. I suppose that choice was deliberate in the sense that I wrote notmuch-search-previous-thread the way I thought it should work without thinking very hard about how it originally worked. I could rework it to keep the original behavior, or keep it this way and document it in the commit message (and maybe NEWS). Personally I would prefer to keep it this way and update show's p binding to behave similarly since I've always found show's p to be confusing. > Best wishes > > Mark > > > --- > > emacs/notmuch.el | 12 +++++++++--- > > 1 file changed, 9 insertions(+), 3 deletions(-) > > > > diff --git a/emacs/notmuch.el b/emacs/notmuch.el > > index f32cfb0..2ece97d 100644 > > --- a/emacs/notmuch.el > > +++ b/emacs/notmuch.el > > @@ -287,18 +287,24 @@ For a mouse binding, return nil." > > (defun notmuch-search-next-thread () > > "Select the next thread in the search results." > > (interactive) > > - (forward-line 1)) > > + (when (notmuch-search-get-result (notmuch-search-result-end)) > > + (goto-char (notmuch-search-result-end)))) > > > > (defun notmuch-search-previous-thread () > > "Select the previous thread in the search results." > > (interactive) > > - (forward-line -1)) > > + (if (notmuch-search-get-result) > > + (unless (bobp) > > + (goto-char (notmuch-search-result-beginning (- (point) 1)))) > > + ;; We must be past the end; jump to the last result > > + (notmuch-search-last-thread))) > > > > (defun notmuch-search-last-thread () > > "Select the last thread in the search results." > > (interactive) > > (goto-char (point-max)) > > - (forward-line -2)) > > + (forward-line -2) > > + (goto-char (notmuch-search-result-beginning))) > > > > (defun notmuch-search-first-thread () > > "Select the first thread in the search results."