From ca45037a1d647c6a954294bb377adeee088be6d3 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 7 Aug 2012 19:47:32 +2000 Subject: [PATCH] Re: Small bug in json-search changes --- 8c/a41a977f859e3cb41863f2d65665101b9c0b04 | 116 ++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 8c/a41a977f859e3cb41863f2d65665101b9c0b04 diff --git a/8c/a41a977f859e3cb41863f2d65665101b9c0b04 b/8c/a41a977f859e3cb41863f2d65665101b9c0b04 new file mode 100644 index 000000000..ddea8c55f --- /dev/null +++ b/8c/a41a977f859e3cb41863f2d65665101b9c0b04 @@ -0,0 +1,116 @@ +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 72F71431FAF + for ; Mon, 6 Aug 2012 16:47:37 -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 CM2wVPwNjHzV for ; + Mon, 6 Aug 2012 16:47:37 -0700 (PDT) +Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU + [18.9.25.15]) + by olra.theworths.org (Postfix) with ESMTP id E4D8C431FAE + for ; Mon, 6 Aug 2012 16:47:36 -0700 (PDT) +X-AuditID: 1209190f-b7f306d0000008b4-84-502057971a31 +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP + id 12.69.02228.79750205; Mon, 6 Aug 2012 19:47:35 -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 q76NlYVE000859; + Mon, 6 Aug 2012 19:47:35 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q76NlXxQ024087 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Mon, 6 Aug 2012 19:47:33 -0400 (EDT) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1SyX1I-0003y2-UO; Mon, 06 Aug 2012 19:47:32 -0400 +Date: Mon, 6 Aug 2012 19:47:32 -0400 +From: Austin Clements +To: Mark Walters +Subject: Re: Small bug in json-search changes +Message-ID: <20120806234732.GM22601@mit.edu> +References: <87boinpqfg.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87boinpqfg.fsf@qmul.ac.uk> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFvrPIsWRmVeSWpSXmKPExsUixCmqrTs9XCHA4NNpRYvVc3ksrt+cyezA + 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZfzfcp+poI23YvKfzAbGw1xdjBwcEgImErMu + s3QxcgKZYhIX7q1n62Lk4hAS2Mcoce7fDHYIZz2jxJ77b6CcE0wSU+b3sYG0CAksYZTo7BIE + sVkEVCR2bl/FCmKzCWhIbNu/nBHEFhHQkbh9aAE7iM0sIC3x7XczE4gtLKArsbdxF1g9L1DN + 8ztvGSFmqks0PLrBAhEXlDg58wkLRK+WxI1/L5lArgaZs/wfB4jJCbTq7MQMkApRoAumnNzG + NoFRaBaS5llImmchNC9gZF7FKJuSW6Wbm5iZU5yarFucnJiXl1qka6KXm1mil5pSuokRHM6S + /DsYvx1UOsQowMGoxMN7gUshQIg1say4MvcQoyQHk5Ior2IoUIgvKT+lMiOxOCO+qDQntfgQ + owQHs5II7x1foBxvSmJlVWpRPkxKmoNFSZz3aspNfyGB9MSS1OzU1ILUIpisDAeHkgTvsTCg + RsGi1PTUirTMnBKENBMHJ8hwHqDhh0FqeIsLEnOLM9Mh8qcYFaXEeZ+BJARAEhmleXC9sHTz + ilEc6BVh3kMgVTzAVAXX/QpoMBPQYG95OZDBJYkIKakGRr81646E2O0zOXdD1jR7lUdZwjy+ + 18x2T6dHr1NXrbQ5u0T8fqrFlk+Ls3daLlKpydBj+Dtr02Ulz8sNB42+f1c06dp9IrVno8nv + /ZocEVpTnv9eVHd7y5c4l33qOb71qiq3dol5FRS9r5jSPuvPgw3bjstcuSJ4v6mafZ5LyH5N + lQ2+D/2f1imxFGckGmoxFxUnAgD5yFh8EgMAAA== +Cc: notmuch@notmuchmail.org +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:47:37 -0000 + +Nice catch. I think the solution is either exactly this, or we should +strip "thread:" off notmuch-search-target-thread when we set it. I +would lean slightly toward the latter so we don't have to generate up +a new (identical) string on every notmuch-search-show-result call, but +I doubt it would make much difference in the grand scheme of things. + +Quoth Mark Walters on Aug 07 at 12:10 am: +> +> 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))))) +> +> -- 2.26.2