Re: [PATCH 1/2] emacs: show: use interactive instead of current-prefix-arg
authorAustin Clements <amdragon@MIT.EDU>
Sun, 13 Oct 2013 03:31:58 +0000 (23:31 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:24 +0000 (09:57 -0800)
12/2847fd80dd6640cab46962dc7a380f92af857c [new file with mode: 0644]

diff --git a/12/2847fd80dd6640cab46962dc7a380f92af857c b/12/2847fd80dd6640cab46962dc7a380f92af857c
new file mode 100644 (file)
index 0000000..db3eb1e
--- /dev/null
@@ -0,0 +1,161 @@
+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 1C65B431FAF\r
+       for <notmuch@notmuchmail.org>; Sat, 12 Oct 2013 20:32:13 -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 3wApmZG55vIv for <notmuch@notmuchmail.org>;\r
+       Sat, 12 Oct 2013 20:32:05 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-7.mit.edu (dmz-mailsec-scanner-7.mit.edu\r
+       [18.7.68.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id EFBA6431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 12 Oct 2013 20:32:04 -0700 (PDT)\r
+X-AuditID: 12074424-b7f528e0000009aa-be-525a143496f0\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 85.B8.02474.4341A525; Sat, 12 Oct 2013 23:32:04 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r9D3W2nb031840; \r
+       Sat, 12 Oct 2013 23:32:03 -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 r9D3W0OD011029\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+       Sat, 12 Oct 2013 23:32:02 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1VVCPP-00062X-GG; Sat, 12 Oct 2013 23:31:59 -0400\r
+Date: Sat, 12 Oct 2013 23:31:58 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH 1/2] emacs: show: use interactive instead of\r
+       current-prefix-arg\r
+Message-ID: <20131013033157.GE10539@mit.edu>\r
+References: <1381348886-5673-1-git-send-email-markwalters1009@gmail.com>\r
+       <1381348886-5673-2-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: <1381348886-5673-2-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IRYrdT1zURiQoy+NjAZ7F6Lo/F9ZszmR2Y\r
+       PHbOusvu8WzVLeYApigum5TUnMyy1CJ9uwSujPub2lgKGmUqlr7pYmlgnCvWxcjJISFgIvHg\r
+       215WCFtM4sK99WxdjFwcQgL7GCUW37rCApIQEtjIKHF2TjVE4jSTxPRtHUwQzhJGiVPb2phB\r
+       qlgEVCWmrDvECGKzCWhIbNu/HMwWEdCRuH1oATuIzSwgLfHtdzMTiC0sECpx9cdaoHUcHLxA\r
+       NZ1PaiFmtjNKnLtyGewkXgFBiZMzn7BA9GpJ3Pj3kgmkHmTO8n8cIGFOAU+JDU3HwcaLCqhI\r
+       TDm5jW0Co9AsJN2zkHTPQuhewMi8ilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdcLzezRC81pXQT\r
+       IzioXVR2MDYfUjrEKMDBqMTDK3EpMkiINbGsuDL3EKMkB5OSKG8XX1SQEF9SfkplRmJxRnxR\r
+       aU5q8SFGCQ5mJRHeTnOgct6UxMqq1KJ8mJQ0B4uSOO8tDvsgIYH0xJLU7NTUgtQimKwMB4eS\r
+       BO8dIaChgkWp6akVaZk5JQhpJg5OkOE8QMPbhYFqeIsLEnOLM9Mh8qcYFaXEeW+DNAuAJDJK\r
+       8+B6YUnnFaM40CvCvCtA2nmACQuu+xXQYCagwT/fRoAMLklESEk1MDJl/3x3juutas/Ntkn5\r
+       Jr0PRF+bGa5OfJ+ptVtF55+I0/dXLSkTj6a9uMP3wM408ZdqzvRdy5WlhFcxzT7fs9mi4q6s\r
+       /xyl2p9i2StSAuQWdPz6/UnnhIqjT+7uEt/TPN/rPy2dJ5Lb617JZr+cv/hjQtI07oVy2cWa\r
+       Fe8PrfgUJNNZ1mpWpsRSnJFoqMVcVJwIAKCVv2cVAwAA\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 03:32:13 -0000\r
+\r
+Code looks good.  Two minor comments below.\r
+\r
+Quoth Mark Walters on Oct 09 at  9:01 pm:\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
+>  emacs/notmuch-show.el |   12 +++++++-----\r
+>  emacs/notmuch.el      |    5 +++--\r
+>  2 files changed, 10 insertions(+), 7 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 5d7e24b..15f9ce6 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
+\r
+Hmm.  Does this work?  Can you activate the button with C-u RET?\r
+\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
+> +The optional ELIDE-TOGGLE inverts the default elide behaviour.\r
+\r
+"ELIDE-TOGGLE, if non-nil, inverts the default elide behavior."?\r
+\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