Re: [PATCH v2] emacs: show: use interactive instead of current-prefix-arg
authorAustin Clements <amdragon@MIT.EDU>
Sun, 13 Oct 2013 15:28:06 +0000 (11:28 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:24 +0000 (09:57 -0800)
56/c8eff361715db84a832457f3b8ab787eb7e960 [new file with mode: 0644]

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