From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8DitHwqR1mCniwAAgWs5BA (envelope-from ) for ; Sat, 26 Jun 2021 04:29:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id SDViGwqR1mCyUQAA1q6Kng (envelope-from ) for ; Sat, 26 Jun 2021 02:29:30 +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 12F9880C5 for ; Sat, 26 Jun 2021 04:29:30 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 73E98290BB; Fri, 25 Jun 2021 22:29:13 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id AD16827D90 for ; Fri, 25 Jun 2021 22:29:03 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:43850) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwy47-00009U-CQ; Fri, 25 Jun 2021 22:29:03 -0400 Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:37900 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 1lwy46-0003CZ-01; Fri, 25 Jun 2021 22:29:03 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH 3/7] emacs/tree: command to toggle search sort order in tree mode Date: Sat, 26 Jun 2021 03:28:42 +0100 Message-Id: <20210626022846.233052-4-jao@gnu.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210626022846.233052-1-jao@gnu.org> References: <20210626022846.233052-1-jao@gnu.org> MIME-Version: 1.0 Message-ID-Hash: S6YNBU6HNGWJ4ULALRWMAE5CKJHNIFOM X-Message-ID-Hash: S6YNBU6HNGWJ4ULALRWMAE5CKJHNIFOM 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=1624674570; 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=MfqBqvnIvuEmJIlU4DTQvkRd5mwzpbjpmZABWkuMFJI=; b=I9jqo/B9Ifbc3IAlAJamvSQ3GGsZ9wzwrq5i8BpxafcfcjoLwIthYgFtW3VUs9g8nNbi6Y jtEUY969trY+AnmMgQ+twfcqMCJrw2H9tn4zMHoRHd9arKMMqO02xj/Kdj0mkTzqIizSNV GR5w4tFEaPQ7dAV627BpBrXgUG1A8KbIk6kpNBULqf8QlHC67ohlYBN9/K9Igqalkv2d6c /lc2ezZcbMqvUQyM2AKJsB9MWiCdsuscrPA+L+cgFhLXH/0BhO7w2HDCOg26UNq7bAHVP1 9NjnWZ4MOPKPNviQ12rdXGjTPxgnLGtEN3bAMi3ay9qilFAPUmaOtsJpcb3cuw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624674570; a=rsa-sha256; cv=none; b=diNxCu9rbu+FJ7YVMoxPuK3iE575aNskglLisX6SfdNbVD5ZFtlImXl56GPC7cXzglDYsp emFAdSRjsVldh8n6gHaUFL5jhW6B2kFq6dGTKSVHh8gtBMVyBGwNBiBKHe6P97amNe3BzR SNF3y3j+YyxHTv+snVWkyucfThSN8VGJ4rO80IKwgvHd9flXIlt0/bI81aOIrRPo6Yofdz 6eI4XDSK26UbJ++hQfKNtUKGcUSZPuxoR3qP/j716wHu/9xjCSsr1A2sIxIT08XIS6V0pt cOkJHtg5c23YAQXYu5Zor6iNbyVbJU1tJcSnS0NYwx8K3LuP4LLgBiKs/TYboQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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: 12F9880C5 X-Spam-Score: -0.96 X-Migadu-Scanner: scn1.migadu.com X-TUID: uTs1kgIjHLJQ 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..c23dacfc 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -322,6 +322,7 @@ then NAME behaves like CMD." ;; that additionally close the message window. (define-key map [remap notmuch-bury-or-kill-this-buffer] 'notmuch-tree-quit) (define-key map [remap notmuch-search] 'notmuch-tree-to-search) + (define-key map [remap notmuch-search] 'notmuch-tree-toggle-order) (define-key map [remap notmuch-help] 'notmuch-tree-help) (define-key map [remap notmuch-mua-new-mail] 'notmuch-tree-new-mail) (define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search) @@ -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