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 B8083431FBC for ; Sat, 14 Jul 2012 16:02:28 -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 FgHzmpW6XK-9 for ; Sat, 14 Jul 2012 16:02:28 -0700 (PDT) Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU [18.9.25.14]) by olra.theworths.org (Postfix) with ESMTP id AF766431FDA for ; Sat, 14 Jul 2012 16:02:26 -0700 (PDT) X-AuditID: 1209190e-b7fb56d0000008b2-15-5001fa824e36 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id DA.27.02226.28AF1005; Sat, 14 Jul 2012 19:02:26 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q6EN2PpM031813; Sat, 14 Jul 2012 19:02:25 -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 q6EN2OMW008499 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 14 Jul 2012 19:02:25 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1SqBM0-0002GI-2G; Sat, 14 Jul 2012 19:02:24 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v3 7/8] emacs: Fix navigation of multi-line search result formats Date: Sat, 14 Jul 2012 19:02:19 -0400 Message-Id: <1342306940-7499-8-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1342306940-7499-1-git-send-email-amdragon@mit.edu> References: <1342140319-19859-1-git-send-email-amdragon@mit.edu> <1342306940-7499-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsUixG6notv0izHA4NcxHos9+7wsVs/lsbh+ cyazA7PH3dNcHjtn3WX3eLbqFnMAcxSXTUpqTmZZapG+XQJXRuumDawFr3kq1nw5ztzAuI+r i5GTQ0LARGL7iyWsELaYxIV769m6GLk4hAT2MUpMPXmcEcLZwChxcdseqMwjJon/GzZBOXMZ JZYefs4E0s8moCGxbf9yRhBbREBaYufd2WBzmQXSJL63vwWKc3AICwRK/NtgBxJmEVCVeHdp HRuIzStgL7H31Q42iDPkJZ7e7wOzOQUcJA5fOAE2RkigTOLGk++sExj5FzAyrGKUTcmt0s1N zMwpTk3WLU5OzMtLLdI11svNLNFLTSndxAgKLE5Jvh2MXw8qHWIU4GBU4uHN9GcIEGJNLCuu zD3EKMnBpCTKu/krY4AQX1J+SmVGYnFGfFFpTmrxIUYJDmYlEV4JkBxvSmJlVWpRPkxKmoNF SZz3SspNfyGB9MSS1OzU1ILUIpisDAeHkgRv4U+gRsGi1PTUirTMnBKENBMHJ8hwHqDh3SA1 vMUFibnFmekQ+VOMilLivL0gCQGQREZpHlwvLPJfMYoDvSLMuxSkigeYNOC6XwENZgIaPOvn P3+gwSWJCCmpBsacDfnxBi67Cj/s4qk+tkpRtaFscayFvMgV381ib58dmsB3Z/81hS2tp5jn CfWpX8pkX2XjHN0Yynh97mH30Lv9Ol/nKEg9yE/20712Nmd+xqmvkllfPp1WmLK3IlG3YSv3 R9Vl3lM9vL5mCpyJLl5q/mdeiLnQBNu1xSU8c1WlT+kdn5xx2VCJpTgj0VCLuag4EQB7BcHT 1wIAAA== 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, 14 Jul 2012 23:02:29 -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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 86f59e0..ec760dc 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -293,18 +293,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." -- 1.7.10