From: Jameson Rollins <jrollins@finestructure.net>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH] emacs: add some convenience functions to show mode
Date: Sun, 14 Nov 2010 17:09:01 -0500 [thread overview]
Message-ID: <87zktbeekd.fsf@servo.finestructure.net> (raw)
Adding three new conveneince functions:
notmuch-show-next-open-message-or-pop
notmuch-show-next-thread
notmuch-show-previous-thread
While these are not currently bound to any keys, I have found them to
be very useful for constructing custom key bindings outside of what
notmuch provides by default. For example:
(define-key notmuch-show-mode-map "a"
(lambda ()
"archive current message and advance"
(interactive)
(notmuch-show-remove-tag "inbox")
(notmuch-show-next-open-message-or-pop)))
(define-key notmuch-show-mode-map "N" 'notmuch-show-next-thread)
(define-key notmuch-show-mode-map "P" 'notmuch-show-previous-thread)
---
emacs/notmuch-show.el | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b89b685..820fd0e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -920,6 +920,45 @@ any effects from previous calls to
(notmuch-show-mark-read)
(notmuch-show-message-adjust))
+(defun notmuch-show-next-open-message-or-pop ()
+ "Show the next message or pop out if none remain."
+ (interactive)
+ (let (r)
+ (while (and (setq r (notmuch-show-goto-message-next))
+ (not (notmuch-show-message-visible-p))))
+ (if r
+ (progn
+ (notmuch-show-mark-read)
+ (notmuch-show-message-adjust))
+ (let ((parent-buffer notmuch-show-parent-buffer))
+ (if parent-buffer
+ (progn
+ (kill-this-buffer)
+ (switch-to-buffer parent-buffer)
+ (forward-line 1)))))))
+
+(defun notmuch-show-next-thread ()
+ "Move to the next thread from the last search."
+ (interactive)
+ (let ((parent-buffer notmuch-show-parent-buffer))
+ (if parent-buffer
+ (progn
+ (kill-this-buffer)
+ (switch-to-buffer parent-buffer)
+ (forward-line 1)
+ (notmuch-search-show-thread)))))
+
+(defun notmuch-show-previous-thread ()
+ "Move to the previous thread from the last search."
+ (interactive)
+ (let ((parent-buffer notmuch-show-parent-buffer))
+ (if parent-buffer
+ (progn
+ (kill-this-buffer)
+ (switch-to-buffer parent-buffer)
+ (forward-line -1)
+ (notmuch-search-show-thread)))))
+
(defun notmuch-show-view-raw-message ()
"View the file holding the current message."
(interactive)
--
1.7.2.3
next reply other threads:[~2010-11-14 22:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-14 22:09 Jameson Rollins [this message]
2010-11-16 19:35 ` [PATCH] emacs: add some convenience functions to show mode Carl Worth
2010-11-16 20:41 ` Jameson Rollins
2010-12-07 22:10 ` Carl Worth
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=87zktbeekd.fsf@servo.finestructure.net \
--to=jrollins@finestructure.net \
--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).