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 174EF431FAF for ; Sun, 13 Oct 2013 00:25:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 i3oz49iX-oXy for ; Sun, 13 Oct 2013 00:25:22 -0700 (PDT) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id F1D6E431FAE for ; Sun, 13 Oct 2013 00:25:21 -0700 (PDT) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1VVG33-0001rM-9g; Sun, 13 Oct 2013 08:25:09 +0100 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) (envelope-from ) id 1VVG32-0007PV-Po; Sun, 13 Oct 2013 08:25:09 +0100 From: Mark Walters To: Austin Clements Subject: Re: [PATCH 1/2] emacs: show: use interactive instead of current-prefix-arg In-Reply-To: <20131013033157.GE10539@mit.edu> References: <1381348886-5673-1-git-send-email-markwalters1009@gmail.com> <1381348886-5673-2-git-send-email-markwalters1009@gmail.com> <20131013033157.GE10539@mit.edu> User-Agent: Notmuch/0.15.2+334~gafd5c6a (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Sun, 13 Oct 2013 08:25:07 +0100 Message-ID: <8761t13a5o.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 93.97.24.31 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: 2a58f6129c5f8acb60553aee6a715217 (of first 20000 bytes) X-SpamAssassin-Score: 0.0 X-SpamAssassin-SpamBar: / X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored 0.0 points. Summary of the scoring: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * 0.0 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean 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 07:25:28 -0000 On Sun, 13 Oct 2013, Austin Clements wrote: > Code looks good. Two minor comments below. That's great. > > 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? This does work: you can activate the button with C-u RET and it does elide the resulting the thread. (This is identical to the current behaviour) > >> '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."? I will fix this. Thanks for the review Mark > >> + >> 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.