From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GC/gNwCR1mCpiwAAgWs5BA (envelope-from ) for ; Sat, 26 Jun 2021 04:29:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yEyUMwCR1mBrYAAAB5/wlQ (envelope-from ) for ; Sat, 26 Jun 2021 02:29:20 +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 2750F80C1 for ; Sat, 26 Jun 2021 04:29:20 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6EF7F290A8; Fri, 25 Jun 2021 22:29:09 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 0545F29033 for ; Fri, 25 Jun 2021 22:29:02 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:43848) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwy45-00008g-L9; Fri, 25 Jun 2021 22:29:01 -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 1lwy45-0003CZ-1x; Fri, 25 Jun 2021 22:29:01 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH 2/7] emacs/hello: honouring :sort-order in threaded queries Date: Sat, 26 Jun 2021 03:28:41 +0100 Message-Id: <20210626022846.233052-3-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: AL545NMTQ7YO6KOHDJB2ND7YAQVMJENW X-Message-ID-Hash: AL545NMTQ7YO6KOHDJB2ND7YAQVMJENW 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=1624674560; 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=ERhfQTpewma9jiStYUmEvIBF6YlaqvI5G75noFEUKJg=; b=s6IlRDq00+5r7khs718MAZhaTGZmOBA7nXD0O0akXR8KNmZV1hTGnoKx7h4SR6T8o6FS3L 0fNaWMqSYGy7uK+YH5dB/NCGO4lO7Bpn/kt2goNgVf80VADxUx30ZfR0Xxm/zrH8xXi6uT 1UIGmAqe8G3gTv0NDZg9SoU1A+r4P0QYBuoCkzmAwYhxAOGh8bII0TNvdz1CLCuyBGNvQ8 LsgfNI01TGl4/yj7YGJui1KWZWWISC5KxbqMcid7f7+KbQOM9E9QTc5NvTauQIzM/FL052 C8eK85Nzi/MVt13jMxUPmyPId/fB3EsMo6ja8DldnLDvBUpL784K1wK3W4vthg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624674560; a=rsa-sha256; cv=none; b=JoOtU0rKXxcGWSwNF98n/MTVGEb3CsFfjKm9xEALVYeOEYgh31emq61ZSzkWpI+7IYJA/8 MKUGenk1wdsbCzWzXZo9WFea1lVkdErk8vRgE5I54+ZLwv6baC5De7TW/NdCtLvrSajTVk yZSUGO25y22LyQtnBype5qnDrxIqBkkFGqYBC0vkFbAddUncPesYftaa4SDs6hFtW4Eu1H PIyVe6pi4Kn+lziKcOlUB8T9fgEI1wao5yJViAsaR1y34zJkT0pwN1dwOblfgyOhplSm3K pVC4gFcbEuWOcczSZkJ85no95mRu9hGlh6cIFjTvtTFpZttAfKXLjrMh9Io+EQ== 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: 2750F80C1 X-Spam-Score: -0.96 X-Migadu-Scanner: scn1.migadu.com X-TUID: PhOpeel4K/aR Now that notmuch show accepts --sort, we can, on the emacs side, use it according to the value of :sort-order in the definition of saved queries. --- emacs/notmuch-hello.el | 4 +++- emacs/notmuch-tree.el | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 531f209d..5e1ff5fe 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -484,7 +484,9 @@ diagonal." (defun notmuch-hello-widget-search (widget &rest _ignore) (cl-case (widget-get widget :notmuch-search-type) (tree - (notmuch-tree (widget-get widget :notmuch-search-terms))) + (notmuch-tree (widget-get widget :notmuch-search-terms) + nil nil nil nil nil nil + (widget-get widget :notmuch-search-oldest-first))) (unthreaded (notmuch-unthreaded (widget-get widget :notmuch-search-terms))) (t diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 00ee78d6..6ef8e439 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -1062,7 +1062,8 @@ Complete list of currently available key bindings: (notmuch-sexp-parse-partial-list 'notmuch-tree-insert-forest-thread results-buf))))) -(defun notmuch-tree-worker (basic-query &optional query-context target open-target unthreaded) +(defun notmuch-tree-worker (basic-query &optional query-context target + open-target unthreaded oldest-first) "Insert the tree view of the search in the current buffer. This is is a helper function for notmuch-tree. The arguments are @@ -1088,6 +1089,7 @@ the same as for the function notmuch-tree." (let* ((search-args (concat basic-query (and query-context (concat " and (" query-context ")")))) + (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first")) (message-arg (if unthreaded "--unthreaded" "--entire-thread"))) (when (equal (car (process-lines notmuch-command "count" search-args)) "0") (setq search-args basic-query)) @@ -1095,7 +1097,7 @@ the same as for the function notmuch-tree." (let ((proc (notmuch-start-notmuch "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel "show" "--body=false" "--format=sexp" "--format-version=4" - message-arg search-args)) + sort-arg message-arg 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. @@ -1114,7 +1116,7 @@ the same as for the function notmuch-tree." notmuch-tree-basic-query)) (defun notmuch-tree (&optional query query-context target buffer-name - open-target unthreaded parent-buffer) + open-target unthreaded parent-buffer oldest-first) "Display threads matching QUERY in tree view. The arguments are: @@ -1143,7 +1145,7 @@ The arguments are: (pop-to-buffer-same-window buffer)) ;; Don't track undo information for this buffer (setq buffer-undo-list t) - (notmuch-tree-worker query query-context target open-target unthreaded) + (notmuch-tree-worker query query-context target open-target unthreaded oldest-first) (setq notmuch-tree-parent-buffer parent-buffer) (setq truncate-lines t)) -- 2.32.0