From: Mark Walters Date: Mon, 6 Aug 2012 23:10:43 +0000 (+0100) Subject: Small bug in json-search changes X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=dd36ef19fc422db807fc1da9407bfa68731728b0;p=notmuch-archives.git Small bug in json-search changes --- diff --git a/d8/b85a61c2bc711f61e0cf9d1f08ec7659171be5 b/d8/b85a61c2bc711f61e0cf9d1f08ec7659171be5 new file mode 100644 index 000000000..ff5d08ce7 --- /dev/null +++ b/d8/b85a61c2bc711f61e0cf9d1f08ec7659171be5 @@ -0,0 +1,106 @@ +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 2E594431FAF + for ; Mon, 6 Aug 2012 16:10:59 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 Bok1rzUbt86K for ; + Mon, 6 Aug 2012 16:10:57 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 04E24431FAE + for ; Mon, 6 Aug 2012 16:10:56 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SyWRm-0006Ow-IL; Tue, 07 Aug 2012 00:10:52 +0100 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SyWRl-0003Du-IX; Tue, 07 Aug 2012 00:10:49 +0100 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Small bug in json-search changes +User-Agent: Notmuch/0.13.2+96~g634443c (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Tue, 07 Aug 2012 00:10:43 +0100 +Message-ID: <87boinpqfg.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: abedaf4e08eafee7200047f8aff39411 (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +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: Mon, 06 Aug 2012 23:10:59 -0000 + + +Hi + +I have found a small bug in the recent changes to notmuch search to use +the JSON output. If you refresh the search buffer "point" does not stay +on the same thread. + +I think the problem is that notmuch-search-refresh-view calls notmuch +search with target-thread set to notmuch-search-find-thread-id which +returns the thread-id with "thread:" prefixed, whereas +notmuch-search-show-result checks for a match with (plist-get result +:thread) which is the thread id with no prefix. + +The patch below fixes this but I am not sure it is the nicest fix. + +Best wishes + +Mark + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index d2d82a9..a53d5a0 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -798,7 +798,7 @@ non-authors is found, assume that all of the authors match." + (insert "\n") + (notmuch-search-color-line beg (point) (plist-get result :tags)) + (put-text-property beg (point) 'notmuch-search-result result)) +- (when (string= (plist-get result :thread) notmuch-search-target-thread) ++ (when (string= (concat "thread:" (plist-get result :thread)) notmuch-search-target-thread) + (setq notmuch-search-target-thread "found") + (goto-char beg))))) + +