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