From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [WIP PATCH 4/4] emacs: search: add key binding for marking a thread
Date: Tue, 22 Apr 2014 21:11:50 +0100 [thread overview]
Message-ID: <1398197510-28224-5-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1398197510-28224-1-git-send-email-markwalters1009@gmail.com>
Add a function for toggling the mark on a thread, by default bound to
",". Also make a marked thread clearly visible: this uses inverse
video as being a bit like selecting. Perhaps actually using the same
face (mainly backgorund colour) as a selection would make sense?
---
emacs/notmuch.el | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index e1ece47..4976f0a 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -179,6 +179,7 @@ (defvar notmuch-search-mode-map
(define-key map "+" 'notmuch-search-add-tag)
(define-key map (kbd "RET") 'notmuch-search-show-thread)
(define-key map "Z" 'notmuch-tree-from-search-current-query)
+ (define-key map "," 'notmuch-search-mark-thread)
map)
"Keymap for \"notmuch search\" buffers.")
(fset 'notmuch-search-mode-map notmuch-search-mode-map)
@@ -604,6 +605,17 @@ (defun notmuch-search-archive-thread (&optional unarchive beg end thread-list)
(notmuch-tag-change-list notmuch-archive-tags unarchive) beg end thread-list))
(notmuch-search-next-thread))
+(defun notmuch-search-mark-thread ()
+ "Toggle the mark on the currently selected thread."
+ (interactive)
+ (let ((thread (notmuch-search-find-thread-id)))
+ (if (member thread notmuch-search-marked-threads)
+ (setq notmuch-search-marked-threads
+ (delete thread notmuch-search-marked-threads))
+ (push (notmuch-search-find-thread-id) notmuch-search-marked-threads)))
+ (notmuch-search-update-result (notmuch-search-get-result))
+ (notmuch-search-next-thread))
+
(defun notmuch-search-update-result (result &optional pos)
"Replace the result object of the thread at POS (or point) by
RESULT and redraw it.
@@ -806,6 +818,9 @@ (defun notmuch-search-show-result (result pos)
(dolist (spec notmuch-search-result-format)
(notmuch-search-insert-field (car spec) (cdr spec) result))
(insert "\n")
+ (when (member (concat "thread:" (plist-get result :thread))
+ notmuch-search-marked-threads)
+ (notmuch-apply-face nil '(:inverse-video t) nil pos (point)))
(notmuch-search-color-line pos (point) (plist-get result :tags))
(put-text-property pos (point) 'notmuch-search-result result))))
--
1.7.10.4
prev parent reply other threads:[~2014-04-22 20:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 20:11 [WIP PATCH 0/4] Add a mark thread option Mark Walters
2014-04-22 20:11 ` [WIP PATCH 1/4] emacs: search: tidy notmuch-search-foreach-result Mark Walters
2014-04-22 20:11 ` [WIP PATCH 2/4] emacs: search: add a marked thread variable and add to relevant functions Mark Walters
2014-04-22 20:11 ` [WIP PATCH 3/4] emacs: search: split foreach-result into list and region variants Mark Walters
2014-04-22 20:11 ` Mark Walters [this message]
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=1398197510-28224-5-git-send-email-markwalters1009@gmail.com \
--to=markwalters1009@gmail.com \
--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).