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 4EC2E6DE104A for ; Thu, 27 Feb 2020 09:17:16 -0800 (PST) Authentication-Results: arlo.cworth.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="r8D+wt7j"; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.039 X-Spam-Level: X-Spam-Status: No, score=0.039 tagged_above=-999 required=5 tests=[AWL=-0.011, 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, 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 cuvg8xAv9pvI for ; Thu, 27 Feb 2020 09:17:15 -0800 (PST) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by arlo.cworth.org (Postfix) with ESMTPS id CAA7F6DE1028 for ; Thu, 27 Feb 2020 09:17:09 -0800 (PST) Received: by mail-wr1-f41.google.com with SMTP id j7so4344983wrp.13 for ; Thu, 27 Feb 2020 09:17:09 -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=0yZoD+JWOdZiYLkrgB0w3IsWQxvSGAek+t007r2g0n4=; b=r8D+wt7jH/QvE+70pLyf5zpXbVOqlRojKM9TkV5u6ymBdOrj/Z/H9ZOab/CRNpN2z3 DFAdi67jDRN/j57CAypGEp5S9haxBOdc07+l5Ca33119SDfEOnNbKxjxpObjgSPPURt8 TmYhSX0KsOI2ScjyFfAcYnD2wAsiMuxHun3rPfSNkqKM+sckucH0z1Sn2RpqArws3WdV fenELsY8dn2ICTAnS+jo87kWX1v7btENHvuMB0R/SAG8pnd47VTTU8tYOndtrakjY4re aY8a9TRW2Vode+b56RIEQFkBlHUIm7D0WVZDbKLDq3Fn08oXv6flZT6F1WIoyhVNLvLV HLyw== 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=0yZoD+JWOdZiYLkrgB0w3IsWQxvSGAek+t007r2g0n4=; b=DUimFGEjTm9DfFsxI+t5k6dlqzr94KQ+NIBkQ1mVpt1V/nqmpJB6IE92InhFPrzHjC NZj/8z2ICKJsMCoBpxCt6eFEW3W72ukGG6EMbCs1Q+9vlhbV28HkgGikR2TyZ6DPakR6 E75myZR8rkAbEHe+T4XbwBrHolLkgN0EdD/iBaaq6IrJl2sNssjCSNzKpwaUtSsb9t2g gXb33WVnLg+oVSa6g4F5wu7mnxKJwEd8HCzl4bQ057IY13GQvPGp6DJbFcMZ07KZe2WI VykvDCwC59nPCJJFqHjsRz955rq+49z1hV5hFSamyK46ck7JJhmg1aMSuM/ZXPHznEXr jE2g== X-Gm-Message-State: APjAAAXFjUgn1d2v1b0cEl3oxcf6pKvZDmsh1FFuCyFOOpw998iBzl3m nDO7JAicBs44z47Fa2cXiEdH9FYD X-Google-Smtp-Source: APXvYqxVVPnXGpGRKxNz8fnE7j5vvbsB8BkQ/XBqmQE5ssKAYykshEpRPaLMZLaNPCcPcR7N0ZIzRw== X-Received: by 2002:adf:b19d:: with SMTP id q29mr5735167wra.211.1582823826929; Thu, 27 Feb 2020 09:17:06 -0800 (PST) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by smtp.gmail.com with ESMTPSA id a184sm8771935wmf.29.2020.02.27.09.17.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Feb 2020 09:17:06 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH 5/6] Add a U binding to switch to unthreaded from other views Date: Thu, 27 Feb 2020 17:16:51 +0000 Message-Id: <20200227171652.18187-6-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:16 -0000 We have shortcuts S and Z to let the user switch to Search view and Tree view with the current search. Add U to let the user switch to unthreaded view from the current search, and ensure that S and Z switch from unthreaded to search and tree veiew respectively. --- emacs/notmuch-show.el | 10 ++++++++++ emacs/notmuch-tree.el | 23 +++++++++++++++++++++-- emacs/notmuch.el | 6 ++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index d4a1389b..214e279f 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -50,6 +50,8 @@ (declare-function notmuch-tree "notmuch-tree" (&optional query query-context target buffer-name open-target unthreaded)) (declare-function notmuch-tree-get-message-properties "notmuch-tree" nil) +(declare-function notmuch-unthreaded + (&optional query query-context target buffer-name open-target)) (declare-function notmuch-read-query "notmuch" (prompt)) (declare-function notmuch-draft-resume "notmuch-draft" (id)) @@ -1471,6 +1473,7 @@ reset based on the original query." (let ((map (make-sparse-keymap))) (set-keymap-parent map notmuch-common-keymap) (define-key map "Z" 'notmuch-tree-from-show-current-query) + (define-key map "U" 'notmuch-unthreaded-from-show-current-query) (define-key map (kbd "") 'widget-backward) (define-key map (kbd "M-TAB") 'notmuch-show-previous-button) (define-key map (kbd "") 'notmuch-show-previous-button) @@ -1559,6 +1562,13 @@ All currently available key bindings: notmuch-show-query-context (notmuch-show-get-message-id))) +(defun notmuch-unthreaded-from-show-current-query () + "Call notmuch unthreaded with the current query" + (interactive) + (notmuch-unthreaded notmuch-show-thread-id + notmuch-show-query-context + (notmuch-show-get-message-id))) + (defun notmuch-show-move-to-message-top () (goto-char (notmuch-show-message-top))) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 895c05f4..9a83292c 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -294,6 +294,8 @@ FUNC." (define-key map [remap notmuch-jump-search] (notmuch-tree-close-message-pane-and #'notmuch-jump-search)) (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) ;; these use notmuch-show functions directly (define-key map "|" 'notmuch-show-pipe-message) @@ -474,6 +476,18 @@ NOT change the database." (notmuch-tree-close-message-window) (notmuch-tree query))) +(defun notmuch-unthreaded-from-tree-current-query () + "Switch from tree view to unthreaded view" + (interactive) + (unless notmuch-tree-unthreaded + (notmuch-tree-refresh-view 'unthreaded))) + +(defun notmuch-tree-from-unthreaded-current-query () + "Switch from unthreaded view to tree view" + (interactive) + (when notmuch-tree-unthreaded + (notmuch-tree-refresh-view 'tree))) + (defun notmuch-search-from-tree-current-query () "Call notmuch search with the current query" (interactive) @@ -635,19 +649,24 @@ message will be \"unarchived\", i.e. the tag changes in (when (window-live-p notmuch-tree-message-window) (notmuch-tree-show-message-in))) -(defun notmuch-tree-refresh-view () +(defun notmuch-tree-refresh-view (&optional view) "Refresh view." (interactive) (when (get-buffer-process (current-buffer)) (error "notmuch tree process already running for current buffer")) (let ((inhibit-read-only t) (basic-query notmuch-tree-basic-query) + (unthreaded (cond ((eq view 'unthreaded) t) + ((eq view 'tree) nil) + (t notmuch-tree-unthreaded))) (query-context notmuch-tree-query-context) (target (notmuch-tree-get-message-id))) (erase-buffer) (notmuch-tree-worker basic-query query-context - target))) + target + nil + unthreaded))) (defun notmuch-tree-thread-top () (when (notmuch-tree-get-message-properties) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 0d68d123..f4789b4f 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -190,6 +190,7 @@ there will be called at other points of notmuch execution." (define-key map (kbd "RET") 'notmuch-search-show-thread) (define-key map (kbd "M-RET") 'notmuch-tree-from-search-thread) (define-key map "Z" 'notmuch-tree-from-search-current-query) + (define-key map "U" 'notmuch-unthreaded-from-search-current-query) map) "Keymap for \"notmuch search\" buffers.") (fset 'notmuch-search-mode-map notmuch-search-mode-map) @@ -523,6 +524,11 @@ thread." (interactive) (notmuch-tree notmuch-search-query-string)) +(defun notmuch-unthreaded-from-search-current-query () + "Call notmuch tree with the current query" + (interactive) + (notmuch-unthreaded notmuch-search-query-string)) + (defun notmuch-tree-from-search-thread () "Show the selected thread with notmuch-tree" (interactive) -- 2.11.0