From: Mark Walters Date: Sun, 22 Jul 2012 15:27:53 +0000 (+0100) Subject: Re: [PATCH v4 0/8] emacs: JSON-based search cleanups X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=2b7d96121e844df9994022f0137b79559da72b51;p=notmuch-archives.git Re: [PATCH v4 0/8] emacs: JSON-based search cleanups --- diff --git a/b2/1ad8744d6f2d224ac1f768604776cd1b982b42 b/b2/1ad8744d6f2d224ac1f768604776cd1b982b42 new file mode 100644 index 000000000..bddefb3b5 --- /dev/null +++ b/b2/1ad8744d6f2d224ac1f768604776cd1b982b42 @@ -0,0 +1,194 @@ +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 0163B431FAF + for ; Sun, 22 Jul 2012 08:28:04 -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 m+h77mIIIfIE for ; + Sun, 22 Jul 2012 08:28:00 -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 2723F431FAE + for ; Sun, 22 Jul 2012 08:28:00 -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 1Ssy4W-0005S7-Sx; Sun, 22 Jul 2012 16:27:55 +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 1Ssy4W-0004UL-FF; Sun, 22 Jul 2012 16:27:52 +0100 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH v4 0/8] emacs: JSON-based search cleanups +In-Reply-To: <1342892232-5659-1-git-send-email-amdragon@mit.edu> +References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> + <1342892232-5659-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.13.2+82~g23d46be (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sun, 22 Jul 2012 16:27:53 +0100 +Message-ID: <877gtvq0hy.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: 7fa17d740af2e6d74b4853cc7a622086 (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: Sun, 22 Jul 2012 15:28:04 -0000 + + +This version looks good to me +1 + +Best wishes + +Mark + +On Sat, 21 Jul 2012, Austin Clements wrote: +> This version fixes several bugs found in the previous version. I +> replaced the insert-before-markers trick in +> notmuch-search-update-result with direct point manipulation. This +> fixes the problem with authors getting unhidden when a result is +> updated with point after the authors on the line (since it no longer +> deletes the region with the invisibility overlay). I also removed the +> scrolling hack (which was partially necessitated by +> insert-before-markers), so that archiving the last visible result will +> properly scroll the buffer instead of jumping point to the middle of +> the visible window. As a result, the window may scroll when updating +> a multiline result, however, it will scroll to show the entire result +> (unlike an earlier version where it scrolled to cut off the result +> because of an interaction with insert-before-markers). Finally, I +> fixed notmuch-search-last-thread so that it behaves like it did before +> when there are no results, rather than failing with an obscure error. +> +> I also updated the customize documentation and NEWS to indicate that +> multiline search results are considered experimental. +> +> Diff from v3: +> +> diff --git a/NEWS b/NEWS +> index 7b33f0d..7b1f36c 100644 +> --- a/NEWS +> +++ b/NEWS +> @@ -25,7 +25,7 @@ The formatting of tags in search results can now be customized +> `notmuch-search-result-format` would usually break tagging from +> search-mode. We no longer make assumptions about the format. +> +> -Multi-line search result formats are now supported +> +Experimental support for multi-line search result formats +> +> It is now possible to embed newlines in +> `notmuch-search-result-format` to make individual search results +> diff --git a/emacs/notmuch.el b/emacs/notmuch.el +> index ec760dc..fd1836f 100644 +> --- a/emacs/notmuch.el +> +++ b/emacs/notmuch.el +> @@ -70,12 +70,12 @@ +> For example: +> (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\) +> \(\"subject\" . \"%s\"\)\)\) +> -Line breaks are permitted in format strings. Note that a line +> -break at the end of an \"authors\" field will get elided if the +> -authors list is long; place it instead at the beginning of the +> -following field. To enter a line break when setting this +> -variable with setq, use \\n. To enter a line break in customize, +> -press \\[quoted-insert] C-j." +> +Line breaks are permitted in format strings (though this is +> +currently experimental). Note that a line break at the end of an +> +\"authors\" field will get elided if the authors list is long; +> +place it instead at the beginning of the following field. To +> +enter a line break when setting this variable with setq, use \\n. +> +To enter a line break in customize, press \\[quoted-insert] C-j." +> :type '(alist :key-type (string) :value-type (string)) +> :group 'notmuch-search) +> +> @@ -310,7 +310,8 @@ For a mouse binding, return nil." +> (interactive) +> (goto-char (point-max)) +> (forward-line -2) +> - (goto-char (notmuch-search-result-beginning))) +> + (let ((beg (notmuch-search-result-beginning))) +> + (when beg (goto-char beg)))) +> +> (defun notmuch-search-first-thread () +> "Select the first thread in the search results." +> @@ -599,30 +600,31 @@ This function advances the next thread when finished." +> +> (defun notmuch-search-update-result (result &optional pos) +> "Replace the result object of the thread at POS (or point) by +> -RESULT and redraw it." +> +RESULT and redraw it. +> + +> +This will keep point in a reasonable location. However, if there +> +are enclosing save-excursions and the saved point is in the +> +result being updated, the point will be restored to the beginning +> +of the result." +> (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) +> ;; Insert the updated thread +> (notmuch-search-show-result result start) +> - ;; There may have been markers pointing into the text we just +> - ;; replaced. For the most part, there's nothing we can do about +> - ;; this, but we can fix markers that were at point (which includes +> - ;; point itself and any save-excursions for which point hasn't +> - ;; moved) by re-inserting the text that should come before point +> - ;; before markers. +> + ;; If point was inside the old result, make an educated guess +> + ;; about where to place it now. Unfortunately, this won't work +> + ;; with save-excursion (or any other markers that would be nice to +> + ;; preserve, such as the window start), but there's nothing we can +> + ;; do about that without a way to retrieve markers in a region. +> (when (and (>= init-point start) (<= init-point end)) +> (let* ((new-end (notmuch-search-result-end start)) +> (new-point (if (= init-point end) +> new-end +> (min init-point (- new-end 1))))) +> - (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))) +> + (goto-char new-point))))) +> +> (defun notmuch-search-process-sentinel (proc msg) +> "Add a message to let user know when \"notmuch search\" exits"