From fc1fbc33e54c3622d65d556c9ee36cbf8132a08f Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Sat, 14 Jul 2012 23:43:19 +2000 Subject: [PATCH] [PATCH v2 0/7] emacs: JSON-based search cleanups --- 42/4f1f7a4842575a25c62950386713eb1c879421 | 118 ++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 42/4f1f7a4842575a25c62950386713eb1c879421 diff --git a/42/4f1f7a4842575a25c62950386713eb1c879421 b/42/4f1f7a4842575a25c62950386713eb1c879421 new file mode 100644 index 000000000..bfbaebee6 --- /dev/null +++ b/42/4f1f7a4842575a25c62950386713eb1c879421 @@ -0,0 +1,118 @@ +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 4785341ED7D + for ; Fri, 13 Jul 2012 20:43:44 -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 Pifu7UV9qry5 for ; + Fri, 13 Jul 2012 20:43:43 -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 0FF3842117A + for ; Fri, 13 Jul 2012 20:43:39 -0700 (PDT) +X-AuditID: 1209190e-b7fb56d0000008b2-57-5000eaeb5c98 +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP + id 5B.44.02226.BEAE0005; Fri, 13 Jul 2012 23:43:39 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q6E3hct1029856; + Fri, 13 Jul 2012 23:43:38 -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 q6E3haXi021322 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Fri, 13 Jul 2012 23:43:38 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1SptGa-0000Zt-Iq; Fri, 13 Jul 2012 23:43:36 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v2 0/7] emacs: JSON-based search cleanups +Date: Fri, 13 Jul 2012 23:43:19 -0400 +Message-Id: <1342237406-32507-1-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1342140319-19859-1-git-send-email-amdragon@mit.edu> +References: <1342140319-19859-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixCmqrPv6FUOAwcUpnBar5/JYXL85k9mB + yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyrjyZT9LwQb+ipbXZxgbGA/ydDFyckgImEi0 + XHzAAmGLSVy4t56ti5GLQ0hgH6PEj2MHmSGcDYwSG7rXMEI4j5gkGg9eZYdw5jJKrF6xmRmk + n01AQ2Lb/uWMILaIgLTEzruzWUFsZgFZiR/n/4DZwgKWEtemHmIHsVkEVCUat5wH6+UVcJDY + cqWbEeIOeYmn9/vYQGxOAUeJDV8ugPUKAdU0HpvJPIGRfwEjwypG2ZTcKt3cxMyc4tRk3eLk + xLy81CJdY73czBK91JTSTYzgUJLk28H49aDSIUYBDkYlHt5Mf4YAIdbEsuLK3EOMkhxMSqK8 + vMBAFOJLyk+pzEgszogvKs1JLT7EKMHBrCTCa94GlONNSaysSi3Kh0lJc7AoifNeSbnpLySQ + nliSmp2aWpBaBJOV4eBQkuDtARkqWJSanlqRlplTgpBm4uAEGc4DNHwySA1vcUFibnFmOkT+ + FKOilDhvAUhCACSRUZoH1wuL9VeM4kCvCPNWglTxANMEXPcroMFMQINn/fznDzS4JBEhJdXA + WJ2rmVu2zSSe7VB+UfyDJS+VH7oVaey+em4Tp+5yjl7+1EWzDC7/Wfj2YkDUlVJbk/rNU/fo + ZL9f/623d23u2aRJO1d/XLvWbMaPDSuen5172Sfsueea09feNm10OhN3tHSW8J3+dvWX5myi + isvMzi5ZvD7w1xTmM61xTHVsPb3Pr39MDvh8vUOJpTgj0VCLuag4EQATnypY0AIAAA== +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 03:43:44 -0000 + +This version updates the docstrings for notmuch-search-update-result +and notmuch-search-show-result and fixes the scrolling artifact in +notmuch-search-update-result. I also updated the commit message of +patch 7 to mention that it changes the behavior of +notmuch-search-previous-thread. + +The diff against v1 is below. + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index 2ece97d..7302fa7 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -583,10 +583,12 @@ This function advances the next thread when finished." + (notmuch-search-next-thread)) + + (defun notmuch-search-update-result (result &optional pos) +- "Update the result object of the current thread and redraw it." ++ "Replace the result object of the thread at POS (or point) by ++RESULT and redraw it." + (let ((start (notmuch-search-result-beginning pos)) + (end (notmuch-search-result-end pos)) + (init-point (point)) ++ (init-start (window-start)) + (inhibit-read-only t)) + ;; Delete the current thread + (delete-region start end) +@@ -603,7 +605,9 @@ This function advances the next thread when finished." + (new-point (if (= init-point end) + new-end + (min init-point (- new-end 1))))) +- (insert-before-markers (delete-and-extract-region start new-point)))))) ++ (insert-before-markers (delete-and-extract-region start new-point)))) ++ ;; We also may have shifted the window scroll. Fix it. ++ (set-window-start (selected-window) init-start))) + + (defun notmuch-search-process-sentinel (proc msg) + "Add a message to let user know when \"notmuch search\" exits" +@@ -766,6 +770,7 @@ non-authors is found, assume that all of the authors match." + 'face 'notmuch-tag-face)))))) + + (defun notmuch-search-show-result (result &optional pos) ++ "Insert RESULT at POS or the end of the buffer if POS is null." + ;; Ignore excluded matches + (unless (= (plist-get result :matched) 0) + (let ((beg (or pos (point-max)))) + -- 2.26.2