From 8e765c9561a724f0009fa55c3edde2d21223a854 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 25 May 2013 14:39:58 +0100 Subject: [PATCH] Re: [PATCH 1/2] emacs: add show view bindings to move to previous/next thread --- 15/e232ced261a35d0b681246441853586f20c00e | 214 ++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 15/e232ced261a35d0b681246441853586f20c00e diff --git a/15/e232ced261a35d0b681246441853586f20c00e b/15/e232ced261a35d0b681246441853586f20c00e new file mode 100644 index 000000000..31c213144 --- /dev/null +++ b/15/e232ced261a35d0b681246441853586f20c00e @@ -0,0 +1,214 @@ +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 1CAF4431FC0 + for ; Sat, 25 May 2013 06:40:13 -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 4RxFfS5QfqrC for ; + Sat, 25 May 2013 06:40:05 -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 A4103431FAF + for ; Sat, 25 May 2013 06:40:04 -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 1UgEhU-0001wB-9e; Sat, 25 May 2013 14:40:00 +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 1UgEhT-0001X3-Se; Sat, 25 May 2013 14:40:00 +0100 +From: Mark Walters +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH 1/2] emacs: add show view bindings to move to + previous/next thread +In-Reply-To: <1369484066-20228-1-git-send-email-jani@nikula.org> +References: <1369484066-20228-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: Sat, 25 May 2013 14:39:58 +0100 +Message-ID: <87a9nj2n69.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: 21e0656bcbfbc012ffb950adb2fc14d7 (of first 20000 bytes) +X-SpamAssassin-Score: -0.1 +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.1 points. + Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.1 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: Tomi Ollila +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, 25 May 2013 13:40:13 -0000 + + +Hi + +> We have most of the plumbing in place, add the bindings M-n and M-p. +> +> --- +> +> v2: reduce duplication by adding PREVIOUS argument to +> notmuch-show-next-thread instead of adding a separate function for +> moving to previous thread (Mark) +> --- +> emacs/notmuch-show.el | 28 ++++++++++++++++++++++++---- +> 1 file changed, 24 insertions(+), 4 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index d56154e..a903395 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") +> @@ -1273,6 +1274,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) +> (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) +> @@ -1834,17 +1837,34 @@ argument, hide all of the messages." +> (interactive) +> (backward-button 1)) +> +> -(defun notmuch-show-next-thread (&optional show-next) +> - "Move to the next item in the search results, if any." +> +(defun notmuch-show-next-thread (&optional show previous) +> + "Move to the next item in the search results, if any. +> + +> +If SHOW is non-nil, open the next item in a show +> +buffer. Otherwise just highlight the next item in the search +> +buffer. If PREVIOUS is non-nil, move to the previous item in the +> +search results instead." +> (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-next-thread) +> - (if show-next +> + (if previous +> + (notmuch-search-previous-thread) +> + (notmuch-search-next-thread)) +> + (if show +> (notmuch-search-show-thread))))) + +Did you want this to not exit back to the search results if you do M-p +on the first result? I attach a version below that does exit back (so +M-p and M-n behave the same. + +Best wishes + +Mark + +>From 22f03457a4c1884d35cf3de32f55977b980b7960 Mon Sep 17 00:00:00 2001 +From: Jani Nikula +Date: Sat, 25 May 2013 15:14:25 +0300 +Subject: [PATCH 1/2] emacs: add show view bindings to move to previous/next + thread + +We have most of the plumbing in place, add the bindings M-n and M-p. +--- + emacs/notmuch-show.el | 30 +++++++++++++++++++++++++----- + 1 files changed, 25 insertions(+), 5 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index d56154e..2b33007 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") +@@ -1273,6 +1274,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) + (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) +@@ -1834,16 +1837,33 @@ argument, hide all of the messages." + (interactive) + (backward-button 1)) + +-(defun notmuch-show-next-thread (&optional show-next) +- "Move to the next item in the search results, if any." ++(defun notmuch-show-next-thread (&optional show previous) ++ "Move to the next item in the search results, if any. ++ ++If SHOW is non-nil, open the next item in a show ++buffer. Otherwise just highlight the next item in the search ++buffer. If PREVIOUS is non-nil, move to the previous item in the ++search results instead." + (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-next-thread) +- (if show-next +- (notmuch-search-show-thread))))) ++ (and (if previous ++ (notmuch-search-previous-thread) ++ (notmuch-search-next-thread)) ++ show ++ (notmuch-search-show-thread))))) ++ ++(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-next-thread t t)) + + (defun notmuch-show-archive-thread (&optional unarchive) + "Archive each message in thread. +-- +1.7.9.1 + -- 2.26.2