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