[PATCH 2/4] emacs: tree: bind o to toggle sort order
authorMark Walters <markwalters1009@gmail.com>
Fri, 26 Jun 2015 22:50:33 +0000 (23:50 +0100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:06 +0000 (14:49 -0700)
5b/4da5647df0021fb8f489ce00a45c72f5cb6814 [new file with mode: 0644]

diff --git a/5b/4da5647df0021fb8f489ce00a45c72f5cb6814 b/5b/4da5647df0021fb8f489ce00a45c72f5cb6814
new file mode 100644 (file)
index 0000000..62c8fa3
--- /dev/null
@@ -0,0 +1,124 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 0F2696DE15D8\r
+ for <notmuch@notmuchmail.org>; Fri, 26 Jun 2015 15:50:54 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.18\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.18 tagged_above=-999 required=5 tests=[AWL=0.750,\r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
+ RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id fmw-wTVJjyWJ for <notmuch@notmuchmail.org>;\r
+ Fri, 26 Jun 2015 15:50:52 -0700 (PDT)\r
+Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com\r
+ [209.85.212.174])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id DD19A6DE13DB\r
+ for <notmuch@notmuchmail.org>; Fri, 26 Jun 2015 15:50:50 -0700 (PDT)\r
+Received: by wiwl6 with SMTP id l6so56397547wiw.0\r
+ for <notmuch@notmuchmail.org>; Fri, 26 Jun 2015 15:50:49 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=/0KRNuxODxNgd0G72Q1PscTWINEZ/ygjJTn6ygGveec=;\r
+ b=S+qLDegNW0aUCLz8OH1yuRwcgecaYiymW6eT+/V5av+TnLZLqdi5OQyjNygkH1r5G+\r
+ reW7fn9TgFfIzL1z3vrH2EY6oO+37UcVOhAiKymABIrJS/vzK1miTv+nEHZRaRbvs/Nf\r
+ t+/mLLjG+ZJv36oy/OdDAwcigeQRVKgqrm8DQ1LAHDPmUnUbCMa+Jd8E4YX326UJm5FP\r
+ BkuIx2Ht1VyxBVOlW61jHJuN1IElxETjx0EK6IZmDWQwrfqAYDsTZCxI7O/WY4WU5tCc\r
+ ZMPaBfVNuCBqnXUYpQQtj69O/MVyEQyEoqUIuxtDAZCq/e/qhMA8TxQvBrA6HGy+pJoP\r
+ G+8Q==\r
+X-Received: by 10.194.58.109 with SMTP id p13mr7352970wjq.36.1435359049406;\r
+ Fri, 26 Jun 2015 15:50:49 -0700 (PDT)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+ by mx.google.com with ESMTPSA id js3sm52131130wjc.5.2015.06.26.15.50.48\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Fri, 26 Jun 2015 15:50:48 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/4] emacs: tree: bind o to toggle sort order\r
+Date: Fri, 26 Jun 2015 23:50:33 +0100\r
+Message-Id: <1435359035-6767-3-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1435359035-6767-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1435359035-6767-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 26 Jun 2015 22:50:54 -0000\r
+\r
+---\r
+ emacs/notmuch-tree.el | 23 ++++++++++++++++++++++-\r
+ 1 file changed, 22 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el\r
+index 8b6cd51..6afed76 100644\r
+--- a/emacs/notmuch-tree.el\r
++++ b/emacs/notmuch-tree.el\r
+@@ -194,6 +194,10 @@ (defvar notmuch-tree-message-buffer nil\r
+ (make-variable-buffer-local 'notmuch-tree-message-buffer)\r
+ (put 'notmuch-tree-message-buffer 'permanent-local t)\r
\r
++(defvar notmuch-tree-oldest-first nil\r
++  "Controls whether to sort oldest-first or not")\r
++(make-variable-buffer-local 'notmuch-tree-oldest-first)\r
++\r
+ (defun notmuch-tree-to-message-pane (func)\r
+   "Execute FUNC in message pane.\r
\r
+@@ -265,6 +269,7 @@ (defvar notmuch-tree-mode-map\r
+     (define-key map "A" 'notmuch-tree-archive-thread)\r
+     (define-key map "a" 'notmuch-tree-archive-message-then-next)\r
+     (define-key map "=" 'notmuch-tree-refresh-view)\r
++    (define-key map "o" 'notmuch-tree-toggle-order)\r
+     (define-key map "z" 'notmuch-tree-to-tree)\r
+     (define-key map "n" 'notmuch-tree-next-matching-message)\r
+     (define-key map "p" 'notmuch-tree-prev-matching-message)\r
+@@ -562,6 +567,18 @@ (defun notmuch-tree-refresh-view ()\r
+                        query-context\r
+                        target)))\r
\r
++(defun notmuch-tree-toggle-order ()\r
++  "Toggle the current search order.\r
++\r
++By default, the threads in `notmuch-tree' are displayed\r
++reverse-chronological order (newest thread at the beginning of\r
++the buffer).\r
++\r
++This command toggles the sort order for the current search."\r
++  (interactive)\r
++  (setq notmuch-tree-oldest-first (not notmuch-tree-oldest-first))\r
++  (notmuch-tree-refresh-view))\r
++\r
+ (defun notmuch-tree-thread-top ()\r
+   (when (notmuch-tree-get-message-properties)\r
+     (while (not (or (notmuch-tree-get-prop :first) (eobp)))\r
+@@ -872,7 +889,11 @@ (defun notmuch-tree-worker (basic-query &optional query-context target open-targ\r
+     (let ((proc (notmuch-start-notmuch\r
+                "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel\r
+                "show" "--body=false" "--format=sexp"\r
+-               message-arg search-args))\r
++               message-arg\r
++               (if oldest-first\r
++                       "--sort=oldest-first"\r
++                     "--sort=newest-first")\r
++               search-args))\r
+         ;; Use a scratch buffer to accumulate partial output.\r
+         ;; This buffer will be killed by the sentinel, which\r
+         ;; should be called no matter how the process dies.\r
+-- \r
+2.1.4\r
+\r