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 1FF266DE1588 for ; Fri, 26 Jun 2015 15:51:06 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.142 X-Spam-Level: X-Spam-Status: No, score=0.142 tagged_above=-999 required=5 tests=[AWL=0.712, 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 PlIayiOC20wA for ; Fri, 26 Jun 2015 15:51:04 -0700 (PDT) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by arlo.cworth.org (Postfix) with ESMTPS id 9ED0B6DE1533 for ; Fri, 26 Jun 2015 15:50:53 -0700 (PDT) Received: by wgck11 with SMTP id k11so99251974wgc.0 for ; Fri, 26 Jun 2015 15:50:52 -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=lF9AseiHbV1HOOIykphuGEHHiwpWoqzziRK7Hhr5rfo=; b=NudNPUpPjIZEYV8bkVHH3SIlNZjLRDkNkfJm3ijIs9HuH3qp7ZZnU72cFhd71ZfIEj AHoJ0KdtnYPTWrWlU9kPLHK8lh0VtWrY2eHQLDEV73jESgeF2MEeEP88zHWgBZGfCOtE 80MV0D0fymWa+YBZNIpJ3p8f46/KNJ4etiKnmtRmZfgr75ewLuWPDECjhyYXQ+hhUvQD HieqQrBIlkEJ4hmC9hxkIJ96NT7/DPeyruM27oCH1WyZe5WbZmhOc3wBJ1+mgUAyKN1g fUm6dDDwNRreASnUWwG/2YyABGPPaZOLdqnnUB7H0bvWwo9jaLj/e674KZwMIpSPbRkb qNXQ== X-Received: by 10.194.200.194 with SMTP id ju2mr6622844wjc.61.1435359050925; Fri, 26 Jun 2015 15:50:50 -0700 (PDT) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by mx.google.com with ESMTPSA id m2sm405830wiy.7.2015.06.26.15.50.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 15:50:50 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH 3/4] emacs: tree: add sort argument to notmuch-tree Date: Fri, 26 Jun 2015 23:50:34 +0100 Message-Id: <1435359035-6767-4-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:51:06 -0000 This is used by the the notmuch-search command notmuch-tree-from-search-current-query which now keeps the sort order the same when calling tree mode with the current search query. It also uses the customize variable notmuch-search-oldest-first as the default for sort order of a tree search (only relevant for interactive use). --- emacs/notmuch-tree.el | 21 +++++++++++++++------ emacs/notmuch.el | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 6afed76..b9d9b91 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -565,7 +565,9 @@ (defun notmuch-tree-refresh-view () (erase-buffer) (notmuch-tree-worker basic-query query-context - target))) + target + nil + notmuch-tree-oldest-first))) (defun notmuch-tree-toggle-order () "Toggle the current search order. @@ -865,7 +867,7 @@ (defun notmuch-tree-process-filter (proc string) (notmuch-sexp-parse-partial-list 'notmuch-tree-insert-forest-thread results-buf))))) -(defun notmuch-tree-worker (basic-query &optional query-context target open-target) +(defun notmuch-tree-worker (basic-query &optional query-context target open-target 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 @@ -876,6 +878,7 @@ (defun notmuch-tree-worker (basic-query &optional query-context target open-targ (setq notmuch-tree-query-context query-context) (setq notmuch-tree-target-msg target) (setq notmuch-tree-open-target open-target) + (setq notmuch-tree-oldest-first oldest-first) (erase-buffer) (goto-char (point-min)) @@ -911,7 +914,7 @@ (defun notmuch-tree-get-query () ")") notmuch-tree-basic-query)) -(defun notmuch-tree (&optional query query-context target buffer-name open-target) +(defun notmuch-tree (&optional query query-context target buffer-name open-target oldest-first) "Display threads matching QUERY in Tree View. The arguments are: @@ -924,8 +927,14 @@ (defun notmuch-tree (&optional query query-context target buffer-name open-targe current if it appears in the tree view results. BUFFER-NAME: the name of the buffer to display the tree view. If it is nil \"*notmuch-tree\" followed by QUERY is used. - OPEN-TARGET: If TRUE open the target message in the message pane." - (interactive) + OPEN-TARGET: If TRUE open the target message in the message pane. + OLDEST-FIRST: If TRUE display threads sorted oldest first" + (interactive + (list + ;; Prompt for a query + nil + ;; use default search order + nil nil nil nil (default-value 'notmuch-search-oldest-first))) (if (null query) (setq query (notmuch-read-query "Notmuch tree view search: "))) (let ((buffer (get-buffer-create (generate-new-buffer-name @@ -937,7 +946,7 @@ (defun notmuch-tree (&optional query query-context target buffer-name open-targe ;; Don't track undo information for this buffer (set 'buffer-undo-list t) - (notmuch-tree-worker query query-context target open-target) + (notmuch-tree-worker query query-context target open-target oldest-first) (setq truncate-lines t)) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 6564816..f1035dc 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -478,7 +478,7 @@ (defun notmuch-search-show-thread (&optional elide-toggle) (defun notmuch-tree-from-search-current-query () "Call notmuch tree with the current query" (interactive) - (notmuch-tree notmuch-search-query-string)) + (notmuch-tree notmuch-search-query-string nil nil nil nil notmuch-search-oldest-first)) (defun notmuch-tree-from-search-thread () "Show the selected thread with notmuch-tree" -- 2.1.4