From: Dirk Hohndel <hohndel@infradead.org>
To: <notmuch@notmuchmail.org>
Subject: [PATCH] Add 'd'elete keybinding to search and show views
Date: Wed, 21 Apr 2010 16:16:03 -0700 [thread overview]
Message-ID: <1271891763-10757-2-git-send-email-hohndel@infradead.org> (raw)
In-Reply-To: <1271891763-10757-1-git-send-email-hohndel@infradead.org>
This is a variation of the 'a'rchive binding - it additionally sets
the "deleted" tag (which notmuchsync uses to trigger pruning of files)
Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
---
emacs/notmuch-show.el | 26 ++++++++++++++++++++++----
emacs/notmuch.el | 10 ++++++++++
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 916b39e..45d1abe 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -520,6 +520,7 @@ function is used. "
(define-key map "+" 'notmuch-show-add-tag)
(define-key map "x" 'notmuch-show-archive-thread-then-exit)
(define-key map "a" 'notmuch-show-archive-thread)
+ (define-key map "d" 'notmuch-show-delete-thread)
(define-key map "N" 'notmuch-show-next-message)
(define-key map "P" 'notmuch-show-previous-message)
(define-key map "n" 'notmuch-show-next-open-message)
@@ -910,10 +911,13 @@ to stdout or stderr will appear in the *Messages* buffer."
(interactive)
(backward-button 1))
-(defun notmuch-show-archive-thread-internal (show-next)
+(defun notmuch-show-archive-or-delete-thread-internal (show-next delete)
;; Remove the tag from the current set of messages.
(goto-char (point-min))
- (loop do (notmuch-show-remove-tag "inbox")
+ (loop do (progn
+ (notmuch-show-remove-tag "inbox")
+ (if delete
+ (notmuch-show-add-tag "deleted")))
until (not (notmuch-show-goto-message-next)))
;; Move to the next item in the search results, if any.
(let ((parent-buffer notmuch-show-parent-buffer))
@@ -925,6 +929,20 @@ to stdout or stderr will appear in the *Messages* buffer."
(if show-next
(notmuch-search-show-thread))))))
+(defun notmuch-show-delete-thread ()
+ "Delete each message in thread, then show next thread from search.
+
+Archive each message currently shown by removing the \"inbox\"
+tag from each. Then kill this buffer and show the next thread
+from the search from which this thread was originally shown.
+
+Note: This command is safe from any race condition of new messages
+being delivered to the same thread. It does not archive the
+entire thread, but only the messages shown in the current
+buffer."
+ (interactive)
+ (notmuch-show-archive-or-delete-thread-internal t t))
+
(defun notmuch-show-archive-thread ()
"Archive each message in thread, then show next thread from search.
@@ -937,12 +955,12 @@ being delivered to the same thread. It does not archive the
entire thread, but only the messages shown in the current
buffer."
(interactive)
- (notmuch-show-archive-thread-internal t))
+ (notmuch-show-archive-or-delete-thread-internal t nil))
(defun notmuch-show-archive-thread-then-exit ()
"Archive each message in thread, then exit back to search results."
(interactive)
- (notmuch-show-archive-thread-internal nil))
+ (notmuch-show-archive-or-delete-thread-internal nil nil))
(defun notmuch-show-do-stash (text)
(kill-new text)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f135bca..372f940 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -254,6 +254,7 @@ For a mouse binding, return nil."
(define-key map [mouse-1] 'notmuch-search-show-thread)
(define-key map "*" 'notmuch-search-operate-all)
(define-key map "a" 'notmuch-search-archive-thread)
+ (define-key map "d" 'notmuch-search-delete-thread)
(define-key map "-" 'notmuch-search-remove-tag)
(define-key map "+" 'notmuch-search-add-tag)
(define-key map (kbd "RET") 'notmuch-search-show-thread)
@@ -551,6 +552,15 @@ This function advances the next thread when finished."
(notmuch-search-remove-tag-thread "inbox")
(forward-line))
+(defun notmuch-search-delete-thread ()
+ "Delete the currently selected thread (remove its \"inbox\" tag and add \"deleted\" tag).
+
+This function advances the next thread when finished."
+ (interactive)
+ (notmuch-search-remove-tag-thread "inbox")
+ (notmuch-search-add-tag-thread "deleted")
+ (forward-line))
+
(defun notmuch-search-process-sentinel (proc msg)
"Add a message to let user know when \"notmuch search\" exits"
(let ((buffer (process-buffer proc))
--
1.6.6.1
next prev parent reply other threads:[~2010-04-21 23:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-21 23:16 add delete keybinding Dirk Hohndel
2010-04-21 23:16 ` Dirk Hohndel [this message]
2010-04-21 23:25 ` [PATCH] Add 'd'elete keybinding to search and show views Jesse Rosenthal
2010-04-21 23:37 ` Jameson Rollins
2010-04-21 23:55 ` Jesse Rosenthal
2010-04-21 23:32 ` Jameson Rollins
2010-04-22 0:20 ` Dirk Hohndel
2010-04-22 5:06 ` Jameson Rollins
2010-04-23 18:58 ` add delete keybinding 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=1271891763-10757-2-git-send-email-hohndel@infradead.org \
--to=hohndel@infradead.org \
--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).