[PATCH (alternative)] emacs: show: tweak handling of prefix-arg
authorMark Walters <markwalters1009@gmail.com>
Wed, 2 Oct 2013 15:50:13 +0000 (16:50 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:13 +0000 (09:57 -0800)
ec/efb4a83dccbf1e4463368333e6ea7104274c35 [new file with mode: 0644]

diff --git a/ec/efb4a83dccbf1e4463368333e6ea7104274c35 b/ec/efb4a83dccbf1e4463368333e6ea7104274c35
new file mode 100644 (file)
index 0000000..b7f0570
--- /dev/null
@@ -0,0 +1,154 @@
+Return-Path: <markwalters1009@gmail.com>\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 11CA4431FCF\r
+       for <notmuch@notmuchmail.org>; Wed,  2 Oct 2013 08:50:36 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.7\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.7 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       FREEMAIL_REPLY=2.499, 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 Kyd679zn5YYp for <notmuch@notmuchmail.org>;\r
+       Wed,  2 Oct 2013 08:50:28 -0700 (PDT)\r
+Received: from mail-we0-f176.google.com (mail-we0-f176.google.com\r
+       [74.125.82.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 73F8B431FD4\r
+       for <notmuch@notmuchmail.org>; Wed,  2 Oct 2013 08:50:28 -0700 (PDT)\r
+Received: by mail-we0-f176.google.com with SMTP id u56so1197320wes.21\r
+       for <notmuch@notmuchmail.org>; Wed, 02 Oct 2013 08:50:24 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+       bh=7WxslFQCufTbTZlmZKYhG15BaEFkkXF4hvljChYI4ZM=;\r
+       b=JqeN4xBLl/HdCkFCsASzXsbhsZLHIQ54JMZyUG6MBWQzm+EIrELftqVS5sLHksJ7QW\r
+       EDDvYc4s2O2QGzAO4jLpppHZ7ZGrXdlCOQwWbhTLF+8npQCcufCHbmu/TI0BFd/6iPDg\r
+       hysIb/XEIqHcYmtz+osFfOQysviV9uN31O9UqVYitiMI3X7qIV0aR1SA7Rtz86HW4iPH\r
+       bBPlOYOuRlgTMPuqOjYuhwyb+zvvK3cxwVOSAYth5Y7eE2cDWk9/AiJiF0ZpMyOlIWZE\r
+       xvNqXHwX3EZ0S9Y8g2dXArk7dfJTNV3BbYG22pIlTuWrm1dbbUshRnuIpEo8e2fOOS4O\r
+       kvuA==\r
+X-Received: by 10.180.187.169 with SMTP id ft9mr24242884wic.14.1380729023344; \r
+       Wed, 02 Oct 2013 08:50:23 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPSA id i8sm4784010wiy.6.1969.12.31.16.00.00\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Wed, 02 Oct 2013 08:50:22 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH (alternative)] emacs: show: tweak handling of prefix-arg\r
+Date: Wed,  2 Oct 2013 16:50:13 +0100\r
+Message-Id: <1380729013-3942-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1380718788-18165-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1380718788-18165-1-git-send-email-markwalters1009@gmail.com>\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: Wed, 02 Oct 2013 15:50:36 -0000\r
+\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
+\r
+This alternative patch would avoid the problem described in\r
+id:1380718788-18165-1-git-send-email-markwalters1009@gmail.com It\r
+changes notmuch-show to use more standard interactive calls to get the\r
+prefix arg.\r
+\r
+In fact my preference is for an even simpler solution: just remove the\r
+prefix-arg functionality here. My main reason is that I would like to\r
+use the prefix arg as the entry to pick (once pick is in mainline); it\r
+would also simplify the code in notmuch-show. Of course it would remove\r
+a little functionality.\r
+\r
+What do people think?\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+\r
+ emacs/notmuch-show.el |    9 +++++----\r
+ emacs/notmuch.el      |    5 +++--\r
+ 2 files changed, 8 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 5d7e24b..f7fa6da 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1080,13 +1080,13 @@ 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 prefix parent-buffer query-context buffer-name)\r
+   "Run \"notmuch show\" with the given thread ID and display results.\r
\r
+ The optional PARENT-BUFFER is the notmuch-search buffer from\r
+@@ -1102,7 +1102,8 @@ 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: \r
++P")\r
+   (let ((buffer-name (generate-new-buffer-name\r
+                     (or buffer-name\r
+                         (concat "*notmuch-" thread-id "*")))))\r
+@@ -1114,7 +1115,7 @@ function is used."\r
+     ;; `notmuch-show-elide-non-matching-messages' in this buffer. If\r
+     ;; there is a prefix argument, invert the default.\r
+     (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages)\r
+-    (if current-prefix-arg\r
++    (if prefix\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..5dda21f 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 prefix)\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
++                    prefix\r
+                     (current-buffer)\r
+                     notmuch-search-query-string\r
+                     ;; Name the buffer based on the subject.\r
+-- \r
+1.7.9.1\r
+\r