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