aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Mark Walters <markwalters1009@gmail.com>2012-03-01 22:30:44 +0000
committerGravatar David Bremner <bremner@debian.org>2012-03-02 08:37:50 -0400
commit119a42571eb8a57e3f6a8ea5e44450c43dd9df04 (patch)
tree06144d6be1dbd2018b0874c567d4462c8dcc4ea4 /emacs
parent7a1beb9e7c7fdf8971a60d810ae24e58c2d09673 (diff)
emacs: show: recognize the exclude flag.
Show mode will recognize the exclude flag by not opening excluding messages by default, and will start at the first matching non-excluded message. If there are no matching non-excluded messages it will go to the first matching (necessarily excluded) message.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el36
1 files changed, 27 insertions, 9 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7c4c0bea..4a606310 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -981,7 +981,8 @@ current buffer, if possible."
;; Message visibility depends on whether it matched the search
;; criteria.
- (notmuch-show-message-visible msg (plist-get msg :match))))
+ (notmuch-show-message-visible msg (and (plist-get msg :match)
+ (not (plist-get msg :excluded))))))
(defun notmuch-show-toggle-process-crypto ()
"Toggle the processing of cryptographic MIME parts."
@@ -1081,11 +1082,7 @@ function is used."
notmuch-show-parent-buffer parent-buffer
notmuch-show-query-context query-context)
(notmuch-show-build-buffer)
-
- ;; Move to the first open message and mark it read
- (if (notmuch-show-message-visible-p)
- (notmuch-show-mark-read)
- (notmuch-show-next-open-message))))
+ (notmuch-show-goto-first-wanted-message)))
(defun notmuch-show-build-buffer ()
(let ((inhibit-read-only t))
@@ -1167,9 +1164,7 @@ reset based on the original query."
(notmuch-show-apply-state state)
;; We're resetting state, so navigate to the first open message
;; and mark it read, just like opening a new show buffer.
- (if (notmuch-show-message-visible-p)
- (notmuch-show-mark-read)
- (notmuch-show-next-open-message)))))
+ (notmuch-show-goto-first-wanted-message))))
(defvar notmuch-show-stash-map
(let ((map (make-sparse-keymap)))
@@ -1601,6 +1596,29 @@ to show, nil otherwise."
(goto-char (point-max))))
r))
+(defun notmuch-show-next-matching-message ()
+ "Show the next matching message."
+ (interactive)
+ (let (r)
+ (while (and (setq r (notmuch-show-goto-message-next))
+ (not (notmuch-show-get-prop :match))))
+ (if r
+ (progn
+ (notmuch-show-mark-read)
+ (notmuch-show-message-adjust))
+ (goto-char (point-max)))))
+
+(defun notmuch-show-goto-first-wanted-message ()
+ "Move to the first open message and mark it read"
+ (goto-char (point-min))
+ (if (notmuch-show-message-visible-p)
+ (notmuch-show-mark-read)
+ (notmuch-show-next-open-message))
+ (when (eobp)
+ (goto-char (point-min))
+ (unless (notmuch-show-get-prop :match)
+ (notmuch-show-next-matching-message))))
+
(defun notmuch-show-previous-open-message ()
"Show the previous open message."
(interactive)