mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
Introduce unthreaded mode
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.
This commit is contained in:
parent
f140bbcb40
commit
63f4ba3057
4 changed files with 24 additions and 9 deletions
|
@ -31,7 +31,7 @@
|
||||||
(declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation))
|
(declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation))
|
||||||
(declare-function notmuch-poll "notmuch" ())
|
(declare-function notmuch-poll "notmuch" ())
|
||||||
(declare-function notmuch-tree "notmuch-tree"
|
(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)
|
(defun notmuch-saved-search-get (saved-search field)
|
||||||
"Get FIELD from SAVED-SEARCH.
|
"Get FIELD from SAVED-SEARCH.
|
||||||
|
|
|
@ -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 "q" 'notmuch-bury-or-kill-this-buffer)
|
||||||
(define-key map "s" 'notmuch-search)
|
(define-key map "s" 'notmuch-search)
|
||||||
(define-key map "z" 'notmuch-tree)
|
(define-key map "z" 'notmuch-tree)
|
||||||
|
(define-key map "u" 'notmuch-unthreaded)
|
||||||
(define-key map "m" 'notmuch-mua-new-mail)
|
(define-key map "m" 'notmuch-mua-new-mail)
|
||||||
(define-key map "g" 'notmuch-refresh-this-buffer)
|
(define-key map "g" 'notmuch-refresh-this-buffer)
|
||||||
(define-key map "=" 'notmuch-refresh-this-buffer)
|
(define-key map "=" 'notmuch-refresh-this-buffer)
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
(declare-function notmuch-count-attachments "notmuch" (mm-handle))
|
(declare-function notmuch-count-attachments "notmuch" (mm-handle))
|
||||||
(declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp))
|
(declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp))
|
||||||
(declare-function notmuch-tree "notmuch-tree"
|
(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-tree-get-message-properties "notmuch-tree" nil)
|
||||||
(declare-function notmuch-read-query "notmuch" (prompt))
|
(declare-function notmuch-read-query "notmuch" (prompt))
|
||||||
(declare-function notmuch-draft-resume "notmuch-draft" (id))
|
(declare-function notmuch-draft-resume "notmuch-draft" (id))
|
||||||
|
|
|
@ -42,6 +42,11 @@
|
||||||
;; the following variable is defined in notmuch.el
|
;; the following variable is defined in notmuch.el
|
||||||
(defvar notmuch-search-query-string)
|
(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
|
(defgroup notmuch-tree nil
|
||||||
"Showing message and thread structure."
|
"Showing message and thread structure."
|
||||||
:group 'notmuch)
|
:group 'notmuch)
|
||||||
|
@ -890,7 +895,7 @@ Complete list of currently available key bindings:
|
||||||
(notmuch-sexp-parse-partial-list 'notmuch-tree-insert-forest-thread
|
(notmuch-sexp-parse-partial-list 'notmuch-tree-insert-forest-thread
|
||||||
results-buf)))))
|
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.
|
"Insert the tree view of the search in the current buffer.
|
||||||
|
|
||||||
This is is a helper function for notmuch-tree. The arguments are
|
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)
|
(interactive)
|
||||||
(notmuch-tree-mode)
|
(notmuch-tree-mode)
|
||||||
(add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
|
(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-basic-query basic-query)
|
||||||
(setq notmuch-tree-query-context (if (or (string= query-context "")
|
(setq notmuch-tree-query-context (if (or (string= query-context "")
|
||||||
(string= query-context "*"))
|
(string= query-context "*"))
|
||||||
|
@ -915,7 +921,7 @@ the same as for the function notmuch-tree."
|
||||||
(let* ((search-args (concat basic-query
|
(let* ((search-args (concat basic-query
|
||||||
(if query-context (concat " and (" query-context ")"))
|
(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")
|
(if (equal (car (process-lines notmuch-command "count" search-args)) "0")
|
||||||
(setq search-args basic-query))
|
(setq search-args basic-query))
|
||||||
(notmuch-tag-clear-cache)
|
(notmuch-tag-clear-cache)
|
||||||
|
@ -940,7 +946,7 @@ the same as for the function notmuch-tree."
|
||||||
")")
|
")")
|
||||||
notmuch-tree-basic-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 unthreaded)
|
||||||
"Display threads matching QUERY in Tree View.
|
"Display threads matching QUERY in Tree View.
|
||||||
|
|
||||||
The arguments are:
|
The arguments are:
|
||||||
|
@ -953,23 +959,31 @@ The arguments are:
|
||||||
current if it appears in the tree view results.
|
current if it appears in the tree view results.
|
||||||
BUFFER-NAME: the name of the buffer to display the tree view. If
|
BUFFER-NAME: the name of the buffer to display the tree view. If
|
||||||
it is nil \"*notmuch-tree\" followed by QUERY is used.
|
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)
|
(interactive)
|
||||||
(if (null query)
|
(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
|
(let ((buffer (get-buffer-create (generate-new-buffer-name
|
||||||
(or buffer-name
|
(or buffer-name
|
||||||
(concat "*notmuch-tree-" query "*")))))
|
(concat "*notmuch-"
|
||||||
|
(if unthreaded "unthreaded-" "tree-")
|
||||||
|
query "*")))))
|
||||||
(inhibit-read-only t))
|
(inhibit-read-only t))
|
||||||
|
|
||||||
(switch-to-buffer buffer))
|
(switch-to-buffer buffer))
|
||||||
;; Don't track undo information for this buffer
|
;; Don't track undo information for this buffer
|
||||||
(set 'buffer-undo-list t)
|
(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))
|
(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))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue