From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id NmWJBcp632BAWAAAgWs5BA (envelope-from ) for ; Fri, 02 Jul 2021 22:44:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id AEWwAMp632B7AQAA1q6Kng (envelope-from ) for ; Fri, 02 Jul 2021 20:44:58 +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 654EAAA83 for ; Fri, 2 Jul 2021 22:44:57 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id ABE30290CC; Fri, 2 Jul 2021 16:44:41 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id AAF0E26C01 for ; Fri, 2 Jul 2021 16:44:31 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:44318) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lzQ1X-000884-BW; Fri, 02 Jul 2021 16:44:31 -0400 Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:47788 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 1lzQ1X-0001Wt-3D; Fri, 02 Jul 2021 16:44:31 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH v3 4/5] emacs/tree: command to toggle search sort order in tree mode Date: Fri, 2 Jul 2021 21:44:23 +0100 Message-Id: <20210702204424.2018666-5-jao@gnu.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210702204424.2018666-1-jao@gnu.org> References: <20210702204424.2018666-1-jao@gnu.org> MIME-Version: 1.0 Message-ID-Hash: CZZ6JFGDIQ34EB5NXOUUGOK2VCMAEVDU X-Message-ID-Hash: CZZ6JFGDIQ34EB5NXOUUGOK2VCMAEVDU 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=1625258697; 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=66n+CYelnFH8F8ZzH3oMlarR07nD4bBCADZdYobopF0=; b=G5sqZ8g/US3WhqNcZfTKd/sSuINYkgQ7lTgwyWButKob3BUN2P8bdCNVjM8eAEIs+rcAJJ LHVU+7/vFby1FRHPXHrhK50IZVMJqQDDafqGn94bpvyo7hUmiQSJKocrhq0rgx5TbuWHrD Md7AJ1OgI0T7/T/64UGakoYxZzCUXmswoxx6QU1kj0dk2Zs3Y0wWPX3TSJkqRI8+wvIa4E 7Npz4vpi/uPXEN1/umdg0EIWBIfXr1G1/APf9iK7T4jzidflKvHbr0w+OFQuLeEpec1ox0 IYsuBWNiwsrDwxq0NNUmGwKLMChY39LvCuGgLaVy3+jevSTTzGiFBT/I/+wBGQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625258697; a=rsa-sha256; cv=none; b=nH29RoS7mRO49+sylb/eZkke7Q1SCzG8IyHgD8fi1CrU1b7IQgo6up8VStd8dI1iZ0PExc NCRHc8cqbu3/PpvNwDlmqHLLIeQwLrR014PVx4ZnQIYBmi2UZ18CV6ogXcGtCWB/kq/KaJ 91G5DMBzZNN+sEAgDkCwS8k4xe1a7/maFo8SE7Z4ahrBjfuOZCgfuLSh3tEI6PJHOnSqNl f8NuPB2IDA2H75BcNDJkopi7QSTV1g8+LHj0gaudMCr/+VOM08a2OmNjaDIgW4P2BuVpKR YDtAffHWCnSlvsHARmmcSI9KxcqIazDAwkpRRxbqux1YWO1tFwHLdUdSzV1Hog== 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.95 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: 654EAAA83 X-Spam-Score: -0.95 X-Migadu-Scanner: scn1.migadu.com X-TUID: PeuwlEpwvSXi 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 49d7659e..b288c05d 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) @@ -751,7 +752,8 @@ nil otherwise." query-context target nil - unthreaded))) + unthreaded + notmuch-search-oldest-first))) (defun notmuch-tree-thread-top () (when (notmuch-tree-get-message-properties) @@ -1073,6 +1075,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 "") @@ -1117,6 +1120,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