From 905255cb4ae4923c8a84b92393fc9d7b81146224 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 14 Oct 2013 11:28:06 +2000 Subject: [PATCH] Re: [PATCH v2] emacs: show: use interactive instead of current-prefix-arg --- 56/c8eff361715db84a832457f3b8ab787eb7e960 | 192 ++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 56/c8eff361715db84a832457f3b8ab787eb7e960 diff --git a/56/c8eff361715db84a832457f3b8ab787eb7e960 b/56/c8eff361715db84a832457f3b8ab787eb7e960 new file mode 100644 index 000000000..13aa36261 --- /dev/null +++ b/56/c8eff361715db84a832457f3b8ab787eb7e960 @@ -0,0 +1,192 @@ +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 42F3A431FAF + for ; Sun, 13 Oct 2013 08:28:19 -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 w+1eOzSN2UCo for ; + Sun, 13 Oct 2013 08:28:13 -0700 (PDT) +Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu + [18.7.68.37]) + by olra.theworths.org (Postfix) with ESMTP id 27562431FAE + for ; Sun, 13 Oct 2013 08:28:13 -0700 (PDT) +X-AuditID: 12074425-b7f1c8e0000009c7-d7-525abc0b03b3 +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP + id 4E.F2.02503.B0CBA525; Sun, 13 Oct 2013 11:28:11 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r9DFSAkF030346; + Sun, 13 Oct 2013 11:28:11 -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.8/8.12.4) with ESMTP id r9DFS8VL006714 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Sun, 13 Oct 2013 11:28:09 -0400 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1VVNaR-0001Ns-9s; Sun, 13 Oct 2013 11:28:07 -0400 +Date: Sun, 13 Oct 2013 11:28:06 -0400 +From: Austin Clements +To: Mark Walters +Subject: Re: [PATCH v2] emacs: show: use interactive instead of + current-prefix-arg +Message-ID: <20131013152806.GF10539@mit.edu> +References: <1381649952-23122-1-git-send-email-markwalters1009@gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1381649952-23122-1-git-send-email-markwalters1009@gmail.com> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IR4hRV1uXeExVk8PmUvsXquTwW12/OZHZg + 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mq7NvcZYcFO1YuGBSewNjHPluhg5OSQETCRO + X1nDCGGLSVy4t56ti5GLQ0hgH6PE5zlzGSGcjYwSS/8/ZIZwTjNJbNy1ixXCWcIo8XbtCTaQ + fhYBVYnHMxaAzWIT0JDYtn85mC0ioCNx+9ACdhCbWUBa4tvvZiYQW1ggRKJ/4mkwmxeo5sXC + LWC2kICnxPPD05gh4oISJ2c+YYHo1ZK48e8lUA0H2Jzl/zhATE4BL4kZu5VBKkQFVCSmnNzG + NoFRaBaS5llImmchNC9gZF7FKJuSW6Wbm5iZU5yarFucnJiXl1qka6GXm1mil5pSuokRFNTs + Lqo7GCccUjrEKMDBqMTDe+B8ZJAQa2JZcWXuIUZJDiYlUV73XVFBQnxJ+SmVGYnFGfFFpTmp + xYcYJTiYlUR4WTKBcrwpiZVVqUX5MClpDhYlcd5bHPZBQgLpiSWp2ampBalFMFkZDg4lCV6O + 3UCNgkWp6akVaZk5JQhpJg5OkOE8QMM1QGp4iwsSc4sz0yHypxgVpcR51UASAiCJjNI8uF5Y + 0nnFKA70ijCvIkgVDzBhwXW/AhrMBDT459sIkMEliQgpqQZGU2en0xcmu0/YzN+02UDBfu/s + qJwH7+uOTJ4V/Fv709L47TrTE1+LtnuETH760fjH67d3VJbsqRXZ72Vp3Fyy/Bjb+RX/9ZI/ + R3EtnLhpme21C05ep7RVrMLeSebs/lle72DSpLA1Yq3HgT4m9xe/1t8oOqf1V13Q6KP0UR+N + LdXB3ZdvT3kUpsRSnJFoqMVcVJwIAFQojB0VAwAA +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: Sun, 13 Oct 2013 15:28:19 -0000 + +LGTM. + +Quoth Mark Walters on Oct 13 at 8:39 am: +> Currently notmuch-show looks at the prefix-arg directly via +> current-prefix-arg. This changes it to use the interactive +> specification. +> +> One test (for elide-toggle functionality) set the prefix arg +> directly. Update this test to set the new argument directly. +> --- +> +> This is version 2 of the patches at +> id:1381348886-5673-1-git-send-email-markwalters1009@gmail.com The +> changes are in fixes in response to Austin's review +> id:20131013033157.GE10539@mit.edu and his comments on irc. +> +> Specifically, this updates the doc string for elide-toggle in +> notmuch-show and folds the test fix in (so the tests should always +> pass) +> +> I can also confirm that C-u RET on an id:-button link does work as +> expected (and as currently): opening the appropriate message with +> inverted elide behaviour. +> +> Best wishes +> +> Mark +> +> +> +> emacs/notmuch-show.el | 12 +++++++----- +> emacs/notmuch.el | 5 +++-- +> test/emacs-show | 3 +-- +> 3 files changed, 11 insertions(+), 9 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 5d7e24b..3189dda 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1080,15 +1080,17 @@ buttons for a corresponding notmuch search." +> (make-text-button (first link) (second link) +> :type 'notmuch-button-type +> 'action `(lambda (arg) +> - (notmuch-show ,(third link))) +> + (notmuch-show ,(third link) current-prefix-arg)) +> 'follow-link t +> 'help-echo "Mouse-1, RET: search for this message" +> 'face goto-address-mail-face))))) +> +> ;;;###autoload +> -(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name) +> +(defun notmuch-show (thread-id &optional elide-toggle parent-buffer query-context buffer-name) +> "Run \"notmuch show\" with the given thread ID and display results. +> +> +ELIDE-TOGGLE, if non-nil, inverts the default elide behavior. +> + +> The optional PARENT-BUFFER is the notmuch-search buffer from +> which this notmuch-show command was executed, (so that the +> next thread from that buffer can be show when done with this +> @@ -1102,7 +1104,7 @@ The optional BUFFER-NAME provides the name of the buffer in +> which the message thread is shown. If it is nil (which occurs +> when the command is called interactively) the argument to the +> function is used." +> - (interactive "sNotmuch show: ") +> + (interactive "sNotmuch show: \nP") +> (let ((buffer-name (generate-new-buffer-name +> (or buffer-name +> (concat "*notmuch-" thread-id "*"))))) +> @@ -1112,9 +1114,9 @@ function is used." +> (setq notmuch-show-process-crypto notmuch-crypto-process-mime) +> ;; Set the default value for +> ;; `notmuch-show-elide-non-matching-messages' in this buffer. If +> - ;; there is a prefix argument, invert the default. +> + ;; elide-toggle is set, invert the default. +> (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages) +> - (if current-prefix-arg +> + (if elide-toggle +> (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages))) +> +> (setq notmuch-show-thread-id thread-id +> diff --git a/emacs/notmuch.el b/emacs/notmuch.el +> index 0ff248b..7124d0a 100644 +> --- a/emacs/notmuch.el +> +++ b/emacs/notmuch.el +> @@ -486,13 +486,14 @@ If BARE is set then do not prefix with \"thread:\"" +> "Return a list of authors for the current region" +> (notmuch-search-properties-in-region :subject beg end)) +> +> -(defun notmuch-search-show-thread () +> +(defun notmuch-search-show-thread (&optional elide-toggle) +> "Display the currently selected thread." +> - (interactive) +> + (interactive "P") +> (let ((thread-id (notmuch-search-find-thread-id)) +> (subject (notmuch-search-find-subject))) +> (if (> (length thread-id) 0) +> (notmuch-show thread-id +> + elide-toggle +> (current-buffer) +> notmuch-search-query-string +> ;; Name the buffer based on the subject. +> diff --git a/test/emacs-show b/test/emacs-show +> index ae70053..fb23db4 100755 +> --- a/test/emacs-show +> +++ b/test/emacs-show +> @@ -91,8 +91,7 @@ test_begin_subtest "notmuch-show: elide non-matching messages (w/ prefix arg to +> test_emacs '(let ((notmuch-show-only-matching-messages nil)) +> (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"") +> (notmuch-test-wait) +> - (let ((current-prefix-arg t)) +> - (notmuch-search-show-thread)) +> + (notmuch-search-show-thread t) +> (notmuch-test-wait) +> (test-visible-output))' +> test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on -- 2.26.2