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 6B38F431FC9 for ; Sat, 21 Jul 2012 10:37:20 -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 9MsC3bVDaKTR for ; Sat, 21 Jul 2012 10:37:19 -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 A7773431FAE for ; Sat, 21 Jul 2012 10:37:19 -0700 (PDT) X-AuditID: 12074422-b7f1f6d00000090b-93-500ae8ce7185 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id 8F.D1.02315.EC8EA005; Sat, 21 Jul 2012 13:37:18 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q6LHbHQ0018464; Sat, 21 Jul 2012 13:37:17 -0400 Received: from drake.dyndns.org (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6LHbFgQ008019 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 21 Jul 2012 13:37:16 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1SsdcB-0001Zu-GG; Sat, 21 Jul 2012 13:37:15 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v4 7/8] emacs: Fix navigation of multi-line search result formats Date: Sat, 21 Jul 2012 13:37:11 -0400 Message-Id: <1342892232-5659-8-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1342892232-5659-1-git-send-email-amdragon@mit.edu> References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> <1342892232-5659-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrXvuBVeAQf8kCYs9+7wsVs/lsbh+ cyazA7PH3dNcHjtn3WX3eLbqFnMAcxSXTUpqTmZZapG+XQJXxrdjq9gLJvBWTLz2m62B8SZX FyMnh4SAiUTjhttMELaYxIV769m6GLk4hAT2MUo8eniWGcLZwChx6d9HKOcRk8S5Je+ZIJy5 jBIbV20G62cT0JDYtn85I4gtIiAtsfPubFYQm1kgTeJ7+1uwuLBAoMTuB1PZQWwWAVWJ89dP g9m8AvYSV7fsY4a4Q17i6f0+NhCbU8BB4tHZAywgtpBAmcTijsOMExj5FzAyrGKUTcmt0s1N zMwpTk3WLU5OzMtLLdI11cvNLNFLTSndxAgKLXYXpR2MPw8qHWIU4GBU4uH1mMUZIMSaWFZc mXuIUZKDSUmUt+8+V4AQX1J+SmVGYnFGfFFpTmrxIUYJDmYlEd5Np4FyvCmJlVWpRfkwKWkO FiVx3mspN/2FBNITS1KzU1MLUotgsjIcHEoSvO7AGBISLEpNT61Iy8wpQUgzcXCCDOcBGi4G UsNbXJCYW5yZDpE/xagoJc5rB5IQAElklObB9cJi/xWjONArwrzfngNV8QDTBlz3K6DBTECD pbPABpckIqSkGhjz10emm1oXxtxZfqw2Wm72nMlN+vpW96Nfan54dz/zZfOUvxeePbjb3rRl mc+cO1e4Hl9X/uB1c+eXd7c81ZI2Lz0YvvdYVOKLg5Ll924qO4jFWrHeSWLbZSTu8bAl2rvv QNytW3c0io7vkzY5Zl+j2TSf7cq7MJlnK7wqLbwfTf+1ud1U8aGCEktxRqKhFnNRcSIAK2SZ NtgCAAA= 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: Sat, 21 Jul 2012 17:37:20 -0000 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 changes the behavior of notmuch-search-previous-thread slightly so that if point isn't at the beginning of a result, it first moves point to the beginning of the result. --- emacs/notmuch.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index d092528..fd1836f 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -293,18 +293,25 @@ 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) + (let ((beg (notmuch-search-result-beginning))) + (when beg (goto-char beg)))) (defun notmuch-search-first-thread () "Select the first thread in the search results." -- 1.7.10