From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org, Austin Clements <amdragon@MIT.EDU>
Subject: Re: [Patch v6 12/13] emacs: show: recognize the exclude flag.
Date: Wed, 29 Feb 2012 09:17:56 +0000 [thread overview]
Message-ID: <87linmvvzv.fsf@qmul.ac.uk> (raw)
In-Reply-To: <1330157204-26094-13-git-send-email-markwalters1009@gmail.com>
The rest of the series still applies to master (bf28c60b9) but this patch
needed rebasing/restructuring to fit with the Austin's keep-state patch.
I attach the new patch below. Of course, if it is easier I can resend
the whole series.
Best wishes
Mark
From 8324bc91e43d04e4c2813fa2a714766bcd057256 Mon Sep 17 00:00:00 2001
From: Mark Walters <markwalters1009@gmail.com>
Date: Sun, 29 Jan 2012 16:32:55 +0000
Subject: [PATCH] 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.
---
emacs/notmuch-show.el | 36 +++++++++++++++++++++++++++---------
1 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 2cca2e2..72a8a6e 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)
--
1.7.2.3
next prev parent reply other threads:[~2012-02-29 9:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-25 8:06 [Patch v6 00/13] Add NOTMUCH_MESSAGE_FLAG_EXCLUDED flag Mark Walters
2012-02-25 8:06 ` [Patch v6 01/13] cli: add --no-exclude option to count and search Mark Walters
2012-02-25 8:06 ` [Patch v6 02/13] cli: Add --no-exclude to the man pages for search and count Mark Walters
2012-02-25 8:06 ` [Patch v6 03/13] test: add tests for new cli --no-exclude option Mark Walters
2012-02-25 8:06 ` [Patch v6 04/13] lib: Rearrange the exclude code in query.cc Mark Walters
2012-02-25 8:06 ` [Patch v6 05/13] lib: Make notmuch_query_search_messages set the exclude flag Mark Walters
2012-02-25 8:06 ` [Patch v6 06/13] lib: Add the exclude flag to notmuch_query_search_threads Mark Walters
2012-02-25 8:06 ` [Patch v6 07/13] test: update search test to reflect exclude flag Mark Walters
2012-02-25 8:06 ` [Patch v6 08/13] cli: Make notmuch-show respect excludes Mark Walters
2012-02-25 8:06 ` [Patch v6 09/13] test: update tests to reflect the exclude flag Mark Walters
2012-02-25 8:06 ` [Patch v6 10/13] man: update manpage for notmuch-show --no-exclude option Mark Walters
2012-02-25 8:06 ` [Patch v6 11/13] cli: omit excluded messages in results where appropriate Mark Walters
2012-02-25 8:06 ` [Patch v6 12/13] emacs: show: recognize the exclude flag Mark Walters
2012-02-29 9:17 ` Mark Walters [this message]
2012-02-25 8:06 ` [Patch v6 13/13] emacs: notmuch.el ignore excluded matches Mark Walters
2012-02-27 22:39 ` [Patch v6 00/13] Add NOTMUCH_MESSAGE_FLAG_EXCLUDED flag Austin Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87linmvvzv.fsf@qmul.ac.uk \
--to=markwalters1009@gmail.com \
--cc=amdragon@MIT.EDU \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).