From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AIdvCdds12CEdQAAgWs5BA (envelope-from ) for ; Sat, 26 Jun 2021 20:07:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sO0CBdds12BUPAAAbx9fmQ (envelope-from ) for ; Sat, 26 Jun 2021 18:07:19 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8B4251104B for ; Sat, 26 Jun 2021 20:07:18 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 78C68290E5; Sat, 26 Jun 2021 14:07:06 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 2B3C32904D for ; Sat, 26 Jun 2021 14:06:56 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:35638) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxChj-0003NX-Re; Sat, 26 Jun 2021 14:06:55 -0400 Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:46268 helo=osgiliath.local) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxChj-0000I6-Jc; Sat, 26 Jun 2021 14:06:55 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH 4/5] emacs/tree: command to toggle search sort order in tree mode Date: Sat, 26 Jun 2021 19:06:49 +0100 Message-Id: <20210626180650.342569-5-jao@gnu.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210626180650.342569-1-jao@gnu.org> References: <20210626022846.233052-1-jao@gnu.org> <20210626180650.342569-1-jao@gnu.org> MIME-Version: 1.0 Message-ID-Hash: HMUSFUVB26KUKLKSNFAF4L6CU2SAEHWM X-Message-ID-Hash: HMUSFUVB26KUKLKSNFAF4L6CU2SAEHWM X-MailFrom: jao@gnu.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jao X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624730838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=S2B6uEGAzkIdproDftLC5ujZA+kGbzFnQ1ENOa/gPeM=; b=c+4G98N3wrCMda0nNUCR2BSFw8thqdmaAcWslxmHDwPYz53Py40kdv4ObVbeMdrcMDWyHP imiWiX9KLjmKfv/uKiudMTbm7DammZbKYbVWr3tpj8MsbsfIWd/qH0gPVjlPtiy9MvMQ76 JRNRBpobXEcJvpC3D1JhjFu/pU9bL3aOR9UJ8eGdKsYn6SnjRL8G4AJ+lGOks1+fFiGcxC CEilWjmXg770LvsbHVIHh7XK5m6ZWBEPmaugpqQeekYgm9mZGpAUz4B0d/A4HPuJqoXRv3 J5c4/E6t0KzP53WjqacyVUE3rdpWTQNZT9CUej1rfz07Tcw2TnZmyZya57CO4A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624730838; a=rsa-sha256; cv=none; b=XuwrXpqXvoSrJ9UXlP/df1x+05uNTkgAwvyXTkN+DTyryBGj2GBuzvhXOfM/LTyLeSSIKD UD5JB176WxDN5JG3VxxwJ6e/aRoT3e9rzezFwDq88mbMzSXnTnVE3/45pYN62ljDDJQ4jB EZphvNEcieWOFyA4/94Sm6LFWmU6T7E43jTgZGjtpGRy59Ab52ftf8N7EQlfcw6GCWqKZx 5U1wnBwPHdkGm/52xaB5nG5iczJO97dwNu0WTWJrEvlwrWPHqhForyqekZuf3mKK1qdgJQ 3WEHPt69qK9Ymq0ZuGQEyQkeeuq+j95O2L/PDuS2g9MaTZnWlJCmoPjSTV0mtg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.96 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 8B4251104B X-Spam-Score: -0.96 X-Migadu-Scanner: scn1.migadu.com X-TUID: x6JPlZbDBshJ New command notmuch-tree-toggle-order for switching the sort order (by reissuing the search with a different flag) in a notmuch-tree buffer. --- emacs/notmuch-tree.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 6ef8e439..c421cf3f 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -326,6 +326,7 @@ then NAME behaves like CMD." (define-key map [remap notmuch-mua-new-mail] 'notmuch-tree-new-mail) (define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search) + (define-key map "o" 'notmuch-tree-toggle-order) (define-key map "S" 'notmuch-search-from-tree-current-query) (define-key map "U" 'notmuch-unthreaded-from-tree-current-query) (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query) @@ -749,7 +750,8 @@ nil otherwise." query-context target nil - unthreaded))) + unthreaded + notmuch-search-oldest-first))) (defun notmuch-tree-thread-top () (when (notmuch-tree-get-message-properties) @@ -1071,6 +1073,7 @@ the same as for the function notmuch-tree." (interactive) (notmuch-tree-mode) (add-hook 'post-command-hook #'notmuch-tree-command-hook t t) + (setq notmuch-search-oldest-first oldest-first) (setq notmuch-tree-unthreaded unthreaded) (setq notmuch-tree-basic-query basic-query) (setq notmuch-tree-query-context (if (or (string= query-context "") @@ -1115,6 +1118,15 @@ the same as for the function notmuch-tree." ")") notmuch-tree-basic-query)) +(defun notmuch-tree-toggle-order () + "Toggle the current search order. + +This command toggles the sort order for the current search. The +default sort order is defined by `notmuch-search-oldest-first'." + (interactive) + (setq notmuch-search-oldest-first (not notmuch-search-oldest-first)) + (notmuch-tree-refresh-view)) + (defun notmuch-tree (&optional query query-context target buffer-name open-target unthreaded parent-buffer oldest-first) "Display threads matching QUERY in tree view. -- 2.32.0