--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\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 94F7B4041E4\r
+ for <notmuch@notmuchmail.org>; Mon, 9 Apr 2012 14:57:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 V7g6D5Rx6cmO for <notmuch@notmuchmail.org>;\r
+ Mon, 9 Apr 2012 14:57:17 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 5A1524041E1\r
+ for <notmuch@notmuchmail.org>; Mon, 9 Apr 2012 14:57:17 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1SHMaF-0007tm-6o; Mon, 09 Apr 2012 22:57:13 +0100\r
+Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
+ helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1SHMaE-0007MH-M3; Mon, 09 Apr 2012 22:57:11 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: get rid of trailing spaces in notmuch-hello view\r
+In-Reply-To: <1331351655-16921-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+References: <1331351655-16921-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+User-Agent: Notmuch/0.12+111~g5c30f66 (http://notmuchmail.org) Emacs/23.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Mon, 09 Apr 2012 22:57:27 +0100\r
+Message-ID: <87ty0s7em0.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 94.192.233.223\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: da980ce2e611f18173bdc00bb5f5e2d1 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -1.8\r
+X-SpamAssassin-SpamBar: -\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -1.8 points.\r
+ Summary of the scoring: \r
+ * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
+ * medium trust\r
+ * [138.37.6.40 listed in list.dnswl.org]\r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+ * domain\r
+ * 0.5 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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: Mon, 09 Apr 2012 21:57:18 -0000\r
+\r
+\r
+This looks fine to me (but I am not a lisp expert).\r
+\r
+Mark\r
+\r
+On Sat, 10 Mar 2012, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
+> This patch removes trailing spaces in notmuch-hello view.\r
+>\r
+> A side effect of this change is that tag/query buttons no longer\r
+> include a space at the end. This means that pressing RET when the\r
+> point is at the first character after the tag/query button no longer\r
+> works (note that this is the standard behavior for buttons). We may\r
+> change this behavior in the future (without adding trailing spaces\r
+> back) if people would find this change inconvenient.\r
+> ---\r
+> emacs/notmuch-hello.el | 30 ++++++++------------\r
+> test/emacs | 2 +-\r
+> test/emacs.expected-output/notmuch-hello | 2 +-\r
+> .../emacs.expected-output/notmuch-hello-long-names | 6 ++--\r
+> .../notmuch-hello-new-section | 2 +-\r
+> .../notmuch-hello-section-counts | 4 +-\r
+> .../notmuch-hello-section-hidden-tag | 2 +-\r
+> .../notmuch-hello-section-with-empty | 2 +-\r
+> .../emacs.expected-output/notmuch-hello-with-empty | 2 +-\r
+> 9 files changed, 23 insertions(+), 29 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+> index 28f39f1..17f7edd 100644\r
+> --- a/emacs/notmuch-hello.el\r
+> +++ b/emacs/notmuch-hello.el\r
+> @@ -429,7 +429,8 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
+> (let* ((widest (notmuch-hello-longest-label searches))\r
+> (tags-and-width (notmuch-hello-tags-per-line widest))\r
+> (tags-per-line (car tags-and-width))\r
+> - (widest (cdr tags-and-width))\r
+> + (column-width (cdr tags-and-width))\r
+> + (column-indent 0)\r
+> (count 0)\r
+> (reordered-list (notmuch-hello-reflect searches tags-per-line))\r
+> ;; Hack the display of the buttons used.\r
+> @@ -441,32 +442,25 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
+> (mapc (lambda (elem)\r
+> ;; (not elem) indicates an empty slot in the matrix.\r
+> (when elem\r
+> + (if (> column-indent 0)\r
+> + (widget-insert (make-string column-indent ? )))\r
+> (let* ((name (first elem))\r
+> (query (second elem))\r
+> - (msg-count (third elem))\r
+> - (formatted-name (format "%s " name)))\r
+> + (msg-count (third elem)))\r
+> (widget-insert (format "%8s "\r
+> (notmuch-hello-nice-number msg-count)))\r
+> - (if (string= formatted-name notmuch-hello-target)\r
+> + (if (string= name notmuch-hello-target)\r
+> (setq found-target-pos (point-marker)))\r
+> (widget-create 'push-button\r
+> :notify #'notmuch-hello-widget-search\r
+> :notmuch-search-terms query\r
+> - formatted-name)\r
+> - (unless (eq (% count tags-per-line) (1- tags-per-line))\r
+> - ;; If this is not the last tag on the line, insert\r
+> - ;; enough space to consume the rest of the column.\r
+> - ;; Because the button for the name is `(1+ (length\r
+> - ;; name))' long (due to the trailing space) we can\r
+> - ;; just insert `(- widest (length name))' spaces - the\r
+> - ;; column separator is included in the button if\r
+> - ;; `(equal widest (length name)'.\r
+> - (widget-insert (make-string (max 0\r
+> - (- widest (length name)))\r
+> - ? )))))\r
+> + name)\r
+> + (setq column-indent\r
+> + (1+ (max 0 (- column-width (length name)))))))\r
+> (setq count (1+ count))\r
+> - (if (eq (% count tags-per-line) 0)\r
+> - (widget-insert "\n")))\r
+> + (when (eq (% count tags-per-line) 0)\r
+> + (setq column-indent 0)\r
+> + (widget-insert "\n")))\r
+> reordered-list)\r
+> \r
+> ;; If the last line was not full (and hence did not include a\r
+> diff --git a/test/emacs b/test/emacs\r
+> index 29a489c..42780af 100755\r
+> --- a/test/emacs\r
+> +++ b/test/emacs\r
+> @@ -39,7 +39,7 @@ test_begin_subtest "Navigation of notmuch-hello to search results"\r
+> test_emacs '(notmuch-hello)\r
+> (goto-char (point-min))\r
+> (re-search-forward "inbox")\r
+> - (widget-button-press (point))\r
+> + (widget-button-press (1- (point)))\r
+> (notmuch-test-wait)\r
+> (test-output)'\r
+> test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox\r
+> diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello\r
+> index 1470790..2d69891 100644\r
+> --- a/test/emacs.expected-output/notmuch-hello\r
+> +++ b/test/emacs.expected-output/notmuch-hello\r
+> @@ -2,7 +2,7 @@\r
+> \r
+> Saved searches: [edit]\r
+> \r
+> - 52 inbox 52 unread \r
+> + 52 inbox 52 unread\r
+> \r
+> Search: .\r
+> \r
+> diff --git a/test/emacs.expected-output/notmuch-hello-long-names b/test/emacs.expected-output/notmuch-hello-long-names\r
+> index be6d2c5..486d0d9 100644\r
+> --- a/test/emacs.expected-output/notmuch-hello-long-names\r
+> +++ b/test/emacs.expected-output/notmuch-hello-long-names\r
+> @@ -2,14 +2,14 @@\r
+> \r
+> Saved searches: [edit]\r
+> \r
+> - 52 inbox 52 unread \r
+> + 52 inbox 52 unread\r
+> \r
+> Search: .\r
+> \r
+> All tags: [hide]\r
+> \r
+> - 52 a-very-long-tag 52 inbox 52 unread \r
+> - 4 attachment 7 signed \r
+> + 52 a-very-long-tag 52 inbox 52 unread\r
+> + 4 attachment 7 signed\r
+> \r
+> Type a search query and hit RET to view matching threads.\r
+> Edit saved searches with the `edit' button.\r
+> diff --git a/test/emacs.expected-output/notmuch-hello-new-section b/test/emacs.expected-output/notmuch-hello-new-section\r
+> index 6a339aa..67fdef2 100644\r
+> --- a/test/emacs.expected-output/notmuch-hello-new-section\r
+> +++ b/test/emacs.expected-output/notmuch-hello-new-section\r
+> @@ -1,4 +1,4 @@\r
+> Test: [hide]\r
+> \r
+> - 52 inbox \r
+> + 52 inbox\r
+> \r
+> diff --git a/test/emacs.expected-output/notmuch-hello-section-counts b/test/emacs.expected-output/notmuch-hello-section-counts\r
+> index 9d79659..7a9827c 100644\r
+> --- a/test/emacs.expected-output/notmuch-hello-section-counts\r
+> +++ b/test/emacs.expected-output/notmuch-hello-section-counts\r
+> @@ -1,5 +1,5 @@\r
+> Test-with-counts: [hide]\r
+> \r
+> - 2 attachment 7 signed \r
+> - 7 inbox 7 unread \r
+> + 2 attachment 7 signed\r
+> + 7 inbox 7 unread\r
+> \r
+> diff --git a/test/emacs.expected-output/notmuch-hello-section-hidden-tag b/test/emacs.expected-output/notmuch-hello-section-hidden-tag\r
+> index 3688e7c..809a114 100644\r
+> --- a/test/emacs.expected-output/notmuch-hello-section-hidden-tag\r
+> +++ b/test/emacs.expected-output/notmuch-hello-section-hidden-tag\r
+> @@ -1,4 +1,4 @@\r
+> Test-with-filtered: [hide]\r
+> \r
+> - 4 attachment 52 inbox 7 signed \r
+> + 4 attachment 52 inbox 7 signed\r
+> \r
+> diff --git a/test/emacs.expected-output/notmuch-hello-section-with-empty b/test/emacs.expected-output/notmuch-hello-section-with-empty\r
+> index dc2568d..5c67317 100644\r
+> --- a/test/emacs.expected-output/notmuch-hello-section-with-empty\r
+> +++ b/test/emacs.expected-output/notmuch-hello-section-with-empty\r
+> @@ -1,4 +1,4 @@\r
+> Test-with-empty: [hide]\r
+> \r
+> - 52 inbox \r
+> + 52 inbox\r
+> \r
+> diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty\r
+> index 5e53222..854e0c2 100644\r
+> --- a/test/emacs.expected-output/notmuch-hello-with-empty\r
+> +++ b/test/emacs.expected-output/notmuch-hello-with-empty\r
+> @@ -2,7 +2,7 @@\r
+> \r
+> Saved searches: [edit]\r
+> \r
+> - 52 inbox 52 unread 0 empty \r
+> + 52 inbox 52 unread 0 empty\r
+> \r
+> Search: .\r
+> \r
+> -- \r
+> 1.7.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r