From b13851e4e525ee54b607c715a230177f62a6c788 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sat, 25 May 2013 15:14:25 +0300 Subject: [PATCH] [PATCH 1/2] emacs: add show view bindings to move to previous/next thread --- 61/8b2c09b378afc2f5660d6743a9f79a8e61ca4d | 139 ++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 61/8b2c09b378afc2f5660d6743a9f79a8e61ca4d diff --git a/61/8b2c09b378afc2f5660d6743a9f79a8e61ca4d b/61/8b2c09b378afc2f5660d6743a9f79a8e61ca4d new file mode 100644 index 000000000..1a62636cc --- /dev/null +++ b/61/8b2c09b378afc2f5660d6743a9f79a8e61ca4d @@ -0,0 +1,139 @@ +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 A3D75431FC0 + for ; Sat, 25 May 2013 05:14:40 -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 BXaIFYICpJWz for ; + Sat, 25 May 2013 05:14:35 -0700 (PDT) +Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com + [209.85.217.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id EC048431FAE + for ; Sat, 25 May 2013 05:14:34 -0700 (PDT) +Received: by mail-lb0-f175.google.com with SMTP id v10so5418781lbd.6 + for ; Sat, 25 May 2013 05:14:33 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; + bh=QpxUoUUwYPDGP0jq+OoVm3QqyOgw9TnoF6tpgn1JP9g=; + b=aCPpDAo++a3/LIvrUf/I+foFu3Vwfh0HWoCi7p+ADDcxVTVo3DQjHl191MvRKR5UF/ + Hen3UqhZ40Rn+AZayV5bc5fKIuK31NWBzT7834yzvCdw5HvloQCzSrc6i7cVzxVRka6r + ccmKGubMGO1hEL1g7aDBCOKOtjwQ7/FlkmnPfj8asKZtgtnWXh77lI33iQcz/KGQ3Ulb + nXe4ly0spAIMEkLAV8Grq5zr8v204FltwIFzm8wWHaQxX71IIP1rQrsZV+BgLLPJuqZO + yqTwPt4lV/DYShbb9VRULfGsrkR0DQDooz+5mBMaW7DzD/lB36RJfiBWDiY4blnafuJg + H9mA== +X-Received: by 10.112.6.6 with SMTP id w6mr10674028lbw.123.1369484073512; + Sat, 25 May 2013 05:14:33 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c376-211.dhcp.inet.fi. + [88.195.118.211]) + by mx.google.com with ESMTPSA id a3sm2066492lbg.2.2013.05.25.05.14.31 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 25 May 2013 05:14:32 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 1/2] emacs: add show view bindings to move to previous/next + thread +Date: Sat, 25 May 2013 15:14:25 +0300 +Message-Id: <1369484066-20228-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 1.7.10.4 +X-Gm-Message-State: + ALoCoQluMlsR7kGShc9ari8IneeLsJQv4cmLpuC6qyHBzlEBygn7Uy7J/m8vlZ+WzSUblhRIKMHr +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 12:14:40 -0000 + +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))))) + ++(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.10.4 + -- 2.26.2