(declare-function notmuch-search-find-thread-id "notmuch" (&optional bare))
(declare-function notmuch-search-find-subject "notmuch" ())
+;; For `notmuch-tree-next-thread-from-search'.
+(declare-function notmuch-search-next-thread "notmuch" ())
+(declare-function notmuch-search-previous-thread "notmuch" ())
+(declare-function notmuch-tree-from-search-thread "notmuch" ())
+
;; the following variable is defined in notmuch.el
(defvar notmuch-search-query-string)
(define-key map [mouse-1] 'notmuch-tree-show-message)
(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-thread-then-next)
(define-key map "a" 'notmuch-tree-archive-message-then-next)
(define-key map "z" 'notmuch-tree-to-tree)
(define-key map "n" 'notmuch-tree-next-matching-message)
(define-key map " " 'notmuch-tree-scroll-or-next)
(define-key map (kbd "DEL") 'notmuch-tree-scroll-message-window-back)
(define-key map "e" 'notmuch-tree-resume-message)
- map))
-(fset 'notmuch-tree-mode-map notmuch-tree-mode-map)
+ map)
+ "Keymap for \"notmuch tree\" buffers.")
(defun notmuch-tree-get-message-properties ()
"Return the properties of the current message as a plist.
(notmuch-tree-close-message-window)
(notmuch-tree query)))
+(defun notmuch-tree-archive-thread-then-next ()
+ "Archive all messages in the current buffer, then show next thread from search."
+ (interactive)
+ (notmuch-tree-archive-thread)
+ (notmuch-tree-next-thread))
+
(defun notmuch-unthreaded-from-tree-current-query ()
"Switch from tree view to unthreaded view."
(interactive)
(setq notmuch-tree-message-window
(split-window-vertically (/ (window-height) 4)))
(with-selected-window notmuch-tree-message-window
- ;; Since we are only displaying one message do not indent.
- (let ((notmuch-show-indent-messages-width 0)
- (notmuch-show-only-matching-messages t))
+ (let (;; Since we are only displaying one message do not indent.
+ (notmuch-show-indent-messages-width 0)
+ (notmuch-show-only-matching-messages t)
+ ;; Ensure that `pop-to-buffer-same-window' uses the
+ ;; window we want it to use.
+ (display-buffer-overriding-action
+ '((display-buffer-same-window)
+ (inhibit-same-window . nil))))
(setq buffer (notmuch-show id))))
;; We need the `let' as notmuch-tree-message-window is buffer local.
(let ((window notmuch-tree-message-window))
(if unthreaded "unthreaded-" "tree-")
query "*")))))
(inhibit-read-only t))
- (switch-to-buffer buffer))
+ (pop-to-buffer-same-window buffer))
;; Don't track undo information for this buffer
(set 'buffer-undo-list t)
(notmuch-tree-worker query query-context target open-target unthreaded)