X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-tree.el;h=254664c4718bfa0affbeb48b4e76054f3db022fa;hb=11ac932a4503872c19987b843d58513c4b9ef76f;hp=02bdd1eef839bec159d300658815479f9e4a63c1;hpb=1abe5a0c5b18bdbc0b25f3d138356ee73fe961d1;p=notmuch diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 02bdd1ee..254664c4 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -24,6 +24,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (require 'mail-parse) (require 'notmuch-lib) @@ -32,7 +34,6 @@ (require 'notmuch-tag) (require 'notmuch-parser) -(eval-when-compile (require 'cl)) (declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line)) (declare-function notmuch-call-notmuch-process "notmuch" (&rest args)) (declare-function notmuch-read-query "notmuch" (prompt)) @@ -319,7 +320,8 @@ FUNC." ;; The main tree view bindings (define-key map (kbd "RET") 'notmuch-tree-show-message) (define-key map [mouse-1] 'notmuch-tree-show-message) - (define-key map "x" 'notmuch-tree-quit) + (define-key map "x" 'notmuch-tree-archive-message-then-next-or-exit) + (define-key map "X" 'notmuch-tree-archive-thread-then-exit) (define-key map "A" 'notmuch-tree-archive-thread) (define-key map "a" 'notmuch-tree-archive-message-then-next) (define-key map "z" 'notmuch-tree-to-tree) @@ -617,6 +619,12 @@ message will be \"unarchived\", i.e. the tag changes in (notmuch-tree-archive-message unarchive) (notmuch-tree-next-matching-message)) +(defun notmuch-tree-archive-thread-then-exit () + "Archive all messages in the current buffer, then exit notmuch-tree." + (interactive) + (notmuch-tree-archive-thread) + (notmuch-tree-quit t)) + (defun notmuch-tree-archive-message-then-next-or-exit () "Archive current message, then show next open message in current thread. @@ -714,10 +722,10 @@ found or nil if not." and call FUNCTION for side effects." (save-excursion (notmuch-tree-thread-top) - (loop collect (funcall function) - do (forward-line) - while (and (notmuch-tree-get-message-properties) - (not (notmuch-tree-get-prop :first)))))) + (cl-loop collect (funcall function) + do (forward-line) + while (and (notmuch-tree-get-message-properties) + (not (notmuch-tree-get-prop :first)))))) (defun notmuch-tree-get-messages-ids-thread-search () "Return a search string for all message ids of messages in the current thread." @@ -898,10 +906,11 @@ message together with all its descendents." (defun notmuch-tree-insert-thread (thread depth tree-status) "Insert the collection of sibling sub-threads THREAD at depth DEPTH in the current forest." (let ((n (length thread))) - (loop for tree in thread - for count from 1 to n - - do (notmuch-tree-insert-tree tree depth tree-status (eq count 1) (eq count n))))) + (cl-loop for tree in thread + for count from 1 to n + do (notmuch-tree-insert-tree tree depth tree-status + (eq count 1) + (eq count n))))) (defun notmuch-tree-insert-forest-thread (forest-thread) "Insert a single complete thread."