From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id C99DB6DE0FBC for ; Thu, 27 Feb 2020 09:17:08 -0800 (PST) Authentication-Results: arlo.cworth.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aoP7P4bL"; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.04 X-Spam-Level: X-Spam-Status: No, score=0.04 tagged_above=-999 required=5 tests=[AWL=-0.009, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 c7NpNYvDfGVc for ; Thu, 27 Feb 2020 09:17:08 -0800 (PST) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by arlo.cworth.org (Postfix) with ESMTPS id 5CEEB6DE101A for ; Thu, 27 Feb 2020 09:17:04 -0800 (PST) Received: by mail-wr1-f44.google.com with SMTP id p18so4376990wre.9 for ; Thu, 27 Feb 2020 09:17:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=svWKofyTGC8qsX/upZyj5s8P1cX99nJK8SZaDLBYjtg=; b=aoP7P4bLSeG1dXcUZwPnt/pI1cWpd7WfeUAMIe0e6x91sAYi6OFkwphL6H/08umidD aw0gc15J5/IlhfvSSIqldjfEKyHTQFQNydl/5DUR5EHVmh2L4Ib9H42STAbiAiOSSaqu nI7/UQCg1SkRgHBfn4kskDnrYxnDUdwpDRDjd/KdBZzn9zlVvDdkiaQgLGRenXbzoVAL V4/wdWKwov54zV76czZTzXVL+zQFJNt2D7oavWujFCpMjvxie6CM6RanzMvD3kO3X5/b wIOxMsSPKxc1dUGrJjgOlzy04jrp9/CSOAJjrawRGj/joSN9Zv7LebIaFvxLGva7cJTn GNzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=svWKofyTGC8qsX/upZyj5s8P1cX99nJK8SZaDLBYjtg=; b=cL1uEkwdf6oBCzHcZ+N/g15q04vl/bf3ZJf6DNdR6pveK9rp3f7JMgYZBiCHakgyZb MZnKqSbFE6R0jlxEOzp7orQdn7uJYoiZu0hgSzYQ0lhQgaVpJBZmtm3K5vwGCO/96BuT RgFrekMg8zMn2vsqsucIj5tR8sJ7KuLAsZAschwGVQpqdB6+NEQVhJ0xlFBfRb/g+9Vy Cuxo/IvYCjCfKZvzuFAxgwTqplgpcsQTW2PRF3b88HiouUyZdrUxobjgCGVmCEGbQ354 gHgLynqrKYthLRWCTy1NeeOCmsJK/u+WAfsiyad/klbZ0ofaRwSB8DRooe1GL7ki07gB v3/g== X-Gm-Message-State: APjAAAXWKVKVpMCkx1IJOu0KedoddbihbQ0fKlWDxlNjjT+LndsnYRVQ SvD5hqcMbyNBBi8FO18hDPdrmC8y X-Google-Smtp-Source: APXvYqxtOylwC8r+jlVKCgHc80Rw/yfcsTBMF3wwpITDguQHYSiQIQ6mJrUXdtCbZqxz5LBR4fie6A== X-Received: by 2002:adf:db84:: with SMTP id u4mr5842288wri.317.1582823822577; Thu, 27 Feb 2020 09:17:02 -0800 (PST) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by smtp.gmail.com with ESMTPSA id h2sm8821815wrt.45.2020.02.27.09.17.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Feb 2020 09:17:02 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH 2/6] Introduce unthreaded mode Date: Thu, 27 Feb 2020 17:16:48 +0000 Message-Id: <20200227171652.18187-3-markwalters1009@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200227171652.18187-1-markwalters1009@gmail.com> References: <20200227171652.18187-1-markwalters1009@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 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: Thu, 27 Feb 2020 17:17:09 -0000 This commit introduces a new 'unthreaded' search mode where each matching message is shown on a separate line. It shares almost all of its code with tree view. Subsequent commits will allow it to diverge slightly in appearance. --- emacs/notmuch-hello.el | 2 +- emacs/notmuch-lib.el | 1 + emacs/notmuch-show.el | 2 +- emacs/notmuch-tree.el | 28 +++++++++++++++++++++------- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index aff8beb5..858446df 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -31,7 +31,7 @@ (declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation)) (declare-function notmuch-poll "notmuch" ()) (declare-function notmuch-tree "notmuch-tree" - (&optional query query-context target buffer-name open-target)) + (&optional query query-context target buffer-name open-target unthreaded)) (defun notmuch-saved-search-get (saved-search field) "Get FIELD from SAVED-SEARCH. diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 8acad267..73b165e4 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -154,6 +154,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an (define-key map "q" 'notmuch-bury-or-kill-this-buffer) (define-key map "s" 'notmuch-search) (define-key map "z" 'notmuch-tree) + (define-key map "u" 'notmuch-unthreaded) (define-key map "m" 'notmuch-mua-new-mail) (define-key map "g" 'notmuch-refresh-this-buffer) (define-key map "=" 'notmuch-refresh-this-buffer) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ef2bf1e0..d4a1389b 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -48,7 +48,7 @@ (declare-function notmuch-count-attachments "notmuch" (mm-handle)) (declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp)) (declare-function notmuch-tree "notmuch-tree" - (&optional query query-context target buffer-name open-target)) + (&optional query query-context target buffer-name open-target unthreaded)) (declare-function notmuch-tree-get-message-properties "notmuch-tree" nil) (declare-function notmuch-read-query "notmuch" (prompt)) (declare-function notmuch-draft-resume "notmuch-draft" (id)) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index c00315e8..80b830dd 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -42,6 +42,11 @@ ;; the following variable is defined in notmuch.el (defvar notmuch-search-query-string) +;; this variable distinguishes the unthreaded display from the normal tree display +(defvar notmuch-tree-unthreaded nil + "A buffer local copy of argument unthreaded to the function notmuch-tree") +(make-variable-buffer-local 'notmuch-tree-unthreaded) + (defgroup notmuch-tree nil "Showing message and thread structure." :group 'notmuch) @@ -890,7 +895,7 @@ 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) +(defun notmuch-tree-worker (basic-query &optional query-context target open-target unthreaded) "Insert the tree view of the search in the current buffer. This is is a helper function for notmuch-tree. The arguments are @@ -898,6 +903,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-tree-unthreaded unthreaded) (setq notmuch-tree-basic-query basic-query) (setq notmuch-tree-query-context (if (or (string= query-context "") (string= query-context "*")) @@ -915,7 +921,7 @@ the same as for the function notmuch-tree." (let* ((search-args (concat basic-query (if query-context (concat " and (" query-context ")")) )) - (message-arg "--entire-thread")) + (message-arg (if unthreaded "--unthreaded" "--entire-thread"))) (if (equal (car (process-lines notmuch-command "count" search-args)) "0") (setq search-args basic-query)) (notmuch-tag-clear-cache) @@ -940,7 +946,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) +(defun notmuch-tree (&optional query query-context target buffer-name open-target unthreaded) "Display threads matching QUERY in Tree View. The arguments are: @@ -953,23 +959,31 @@ The arguments are: 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." + OPEN-TARGET: If TRUE open the target message in the message pane. + UNTHREADED: If TRUE only show matching messages in an unthreaded view." (interactive) (if (null query) - (setq query (notmuch-read-query "Notmuch tree view search: "))) + (setq query (notmuch-read-query (concat "Notmuch " + (if unthreaded "unthreaded " "tree ") + "view search: ")))) (let ((buffer (get-buffer-create (generate-new-buffer-name (or buffer-name - (concat "*notmuch-tree-" query "*"))))) + (concat "*notmuch-" + (if unthreaded "unthreaded-" "tree-") + query "*"))))) (inhibit-read-only t)) (switch-to-buffer buffer)) ;; 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 unthreaded) (setq truncate-lines t)) +(defun notmuch-unthreaded (&optional query query-context target buffer-name open-target) + (interactive) + (notmuch-tree query query-context target buffer-name open-target t)) ;; -- 2.11.0