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 2A456431FAF for ; Sat, 4 May 2013 16:17:11 -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 Mvj2cv2JxEOT for ; Sat, 4 May 2013 16:17:06 -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 37D90431FAE for ; Sat, 4 May 2013 16:17:06 -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 1UYlhG-0002GF-98; Sun, 05 May 2013 00:16:58 +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 1UYlhF-00053e-Sr; Sun, 05 May 2013 00:16:54 +0100 From: Mark Walters To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH REBASE] emacs: add show view bindings to move to previous/next thread In-Reply-To: <1367514302-30196-1-git-send-email-jani@nikula.org> References: <1367514302-30196-1-git-send-email-jani@nikula.org> User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Sun, 05 May 2013 00:16:52 +0100 Message-ID: <87bo8q72u3.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: 04f9fab45664fd0c766aa1662950a201 (of first 20000 bytes) X-SpamAssassin-Score: -1.8 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 -1.8 points. Summary of the scoring: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, * medium trust * [138.37.6.40 listed in list.dnswl.org] * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * 0.5 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean 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: Sat, 04 May 2013 23:17:11 -0000 Hi This seems like a useful addition to me. I have a couple of comments and a little bikeshedding below. On Thu, 02 May 2013, Jani Nikula wrote: > We have most of the plumbing in place, add the bindings M-n and M-p. > --- > emacs/notmuch-show.el | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index face2a0..7f6ea65 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -39,6 +39,7 @@ > > (declare-function notmuch-call-notmuch-process "notmuch" (&rest args)) > (declare-function notmuch-search-next-thread "notmuch" nil) > +(declare-function notmuch-search-previous-thread "notmuch" nil) > (declare-function notmuch-search-show-thread "notmuch" nil) > > (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date") > @@ -1267,6 +1268,8 @@ reset based on the original query." > (define-key map "P" 'notmuch-show-previous-message) > (define-key map "n" 'notmuch-show-next-open-message) > (define-key map "p" 'notmuch-show-previous-open-message) > + (define-key map (kbd "M-n") 'notmuch-show-next-thread-show) > + (define-key map (kbd "M-p") 'notmuch-show-previous-thread-show) These seem sensible bindings. > (define-key map (kbd "DEL") 'notmuch-show-rewind) > (define-key map " " 'notmuch-show-advance-and-archive) > (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) > @@ -1839,6 +1842,27 @@ argument, hide all of the messages." > (if show-next > (notmuch-search-show-thread))))) > > +(defun notmuch-show-previous-thread (&optional show-previous) > + "Move to the next item in the search results, if any." ^^ Should be previous item. > + (interactive "P") > + (let ((parent-buffer notmuch-show-parent-buffer)) > + (notmuch-kill-this-buffer) > + (when (buffer-live-p parent-buffer) > + (switch-to-buffer parent-buffer) > + (notmuch-search-previous-thread) > + (if show-previous > + (notmuch-search-show-thread))))) > + If you change this to (if (and (notmuch-search-previous-thread) show-previous) (notmuch-search-show-thread))))) then if you apply it to the first thread it jumps back to the search menu which is consistent with the next-thread version. I would have a slight preference for adding another optional argument notmuch-show-next-thread (&optional show-message previous) where if PREVIOUS is set then it would go back otherwise forward. But I with the duplicated version too. Best wishes Mark > +(defun notmuch-show-next-thread-show () > + "Show the next thread in the search results, if any." > + (interactive) > + (notmuch-show-next-thread t)) > + > +(defun notmuch-show-previous-thread-show () > + "Show the previous thread in the search results, if any." > + (interactive) > + (notmuch-show-previous-thread t)) > + > (defun notmuch-show-archive-thread (&optional unarchive) > "Archive each message in thread. > > -- > 1.7.10.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch