[PATCH v2 0/7] emacs: JSON-based search cleanups
authorAustin Clements <amdragon@MIT.EDU>
Sat, 14 Jul 2012 03:43:19 +0000 (23:43 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:17 +0000 (09:48 -0800)
42/4f1f7a4842575a25c62950386713eb1c879421 [new file with mode: 0644]

diff --git a/42/4f1f7a4842575a25c62950386713eb1c879421 b/42/4f1f7a4842575a25c62950386713eb1c879421
new file mode 100644 (file)
index 0000000..bfbaebe
--- /dev/null
@@ -0,0 +1,118 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4785341ED7D\r
+       for <notmuch@notmuchmail.org>; Fri, 13 Jul 2012 20:43:44 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id Pifu7UV9qry5 for <notmuch@notmuchmail.org>;\r
+       Fri, 13 Jul 2012 20:43:43 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
+       [18.9.25.14])\r
+       by olra.theworths.org (Postfix) with ESMTP id 0FF3842117A\r
+       for <notmuch@notmuchmail.org>; Fri, 13 Jul 2012 20:43:39 -0700 (PDT)\r
+X-AuditID: 1209190e-b7fb56d0000008b2-57-5000eaeb5c98\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 5B.44.02226.BEAE0005; Fri, 13 Jul 2012 23:43:39 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q6E3hct1029856; \r
+       Fri, 13 Jul 2012 23:43:38 -0400\r
+Received: from drake.dyndns.org\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6E3haXi021322\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Fri, 13 Jul 2012 23:43:38 -0400 (EDT)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SptGa-0000Zt-Iq; Fri, 13 Jul 2012 23:43:36 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 0/7] emacs: JSON-based search cleanups\r
+Date: Fri, 13 Jul 2012 23:43:19 -0400\r
+Message-Id: <1342237406-32507-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1342140319-19859-1-git-send-email-amdragon@mit.edu>\r
+References: <1342140319-19859-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixCmqrPv6FUOAwcUpnBar5/JYXL85k9mB\r
+       yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyrjyZT9LwQb+ipbXZxgbGA/ydDFyckgImEi0\r
+       XHzAAmGLSVy4t56ti5GLQ0hgH6PEj2MHmSGcDYwSG7rXMEI4j5gkGg9eZYdw5jJKrF6xmRmk\r
+       n01AQ2Lb/uWMILaIgLTEzruzWUFsZgFZiR/n/4DZwgKWEtemHmIHsVkEVCUat5wH6+UVcJDY\r
+       cqWbEeIOeYmn9/vYQGxOAUeJDV8ugPUKAdU0HpvJPIGRfwEjwypG2ZTcKt3cxMyc4tRk3eLk\r
+       xLy81CJdY73czBK91JTSTYzgUJLk28H49aDSIUYBDkYlHt5Mf4YAIdbEsuLK3EOMkhxMSqK8\r
+       vMBAFOJLyk+pzEgszogvKs1JLT7EKMHBrCTCa94GlONNSaysSi3Kh0lJc7AoifNeSbnpLySQ\r
+       nliSmp2aWpBaBJOV4eBQkuDtARkqWJSanlqRlplTgpBm4uAEGc4DNHwySA1vcUFibnFmOkT+\r
+       FKOilDhvAUhCACSRUZoH1wuL9VeM4kCvCPNWglTxANMEXPcroMFMQINn/fznDzS4JBEhJdXA\r
+       WJ2rmVu2zSSe7VB+UfyDJS+VH7oVaey+em4Tp+5yjl7+1EWzDC7/Wfj2YkDUlVJbk/rNU/fo\r
+       ZL9f/623d23u2aRJO1d/XLvWbMaPDSuen5172Sfsueea09feNm10OhN3tHSW8J3+dvWX5myi\r
+       isvMzi5ZvD7w1xTmM61xTHVsPb3Pr39MDvh8vUOJpTgj0VCLuag4EQATnypY0AIAAA==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 14 Jul 2012 03:43:44 -0000\r
+\r
+This version updates the docstrings for notmuch-search-update-result\r
+and notmuch-search-show-result and fixes the scrolling artifact in\r
+notmuch-search-update-result.  I also updated the commit message of\r
+patch 7 to mention that it changes the behavior of\r
+notmuch-search-previous-thread.\r
+\r
+The diff against v1 is below.\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 2ece97d..7302fa7 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -583,10 +583,12 @@ This function advances the next thread when finished."\r
+   (notmuch-search-next-thread))\r
\r
+ (defun notmuch-search-update-result (result &optional pos)\r
+-  "Update the result object of the current thread and redraw it."\r
++  "Replace the result object of the thread at POS (or point) by\r
++RESULT and redraw it."\r
+   (let ((start (notmuch-search-result-beginning pos))\r
+       (end (notmuch-search-result-end pos))\r
+       (init-point (point))\r
++      (init-start (window-start))\r
+       (inhibit-read-only t))\r
+     ;; Delete the current thread\r
+     (delete-region start end)\r
+@@ -603,7 +605,9 @@ This function advances the next thread when finished."\r
+            (new-point (if (= init-point end)\r
+                           new-end\r
+                         (min init-point (- new-end 1)))))\r
+-      (insert-before-markers (delete-and-extract-region start new-point))))))\r
++      (insert-before-markers (delete-and-extract-region start new-point))))\r
++    ;; We also may have shifted the window scroll.  Fix it.\r
++    (set-window-start (selected-window) init-start)))\r
\r
+ (defun notmuch-search-process-sentinel (proc msg)\r
+   "Add a message to let user know when \"notmuch search\" exits"\r
+@@ -766,6 +770,7 @@ non-authors is found, assume that all of the authors match."\r
+                         'face 'notmuch-tag-face))))))\r
\r
+ (defun notmuch-search-show-result (result &optional pos)\r
++  "Insert RESULT at POS or the end of the buffer if POS is null."\r
+   ;; Ignore excluded matches\r
+   (unless (= (plist-get result :matched) 0)\r
+     (let ((beg (or pos (point-max))))\r
+\r