From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: cleanup and simplify `notmuch-show-archive-thread' and related functions
Date: Wed, 8 Feb 2012 20:48:51 +0400 [thread overview]
Message-ID: <1328719731-13402-1-git-send-email-dmitry.kurochkin@gmail.com> (raw)
Recent changes in notmuch-show tagging introduced some code
duplication. The patch cleanups and simplifies
`notmuch-show-archive-thread' function by using
`notmuch-show-tag-all', no longer used function are removed. After
the change, `notmuch-show-archive-thread' function becomes symmetric
with `notmuch-show-archive-message'.
A side effect of these changes is that `notmuch-show-archive-thread'
no longer calls "notmuch tag" for each message in the thread.
---
emacs/notmuch-show.el | 25 ++-----------------------
1 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index faa9f9b..8199f56 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1598,26 +1598,6 @@ argument, hide all of the messages."
(interactive)
(backward-button 1))
-(defun notmuch-show-tag-thread-internal (tag &optional remove)
- "Add tag to the current set of messages.
-
-If the remove switch is given, tags will be removed instead of
-added."
- (goto-char (point-min))
- (let ((op (if remove "-" "+")))
- (loop do (notmuch-show-tag-message (concat op tag))
- until (not (notmuch-show-goto-message-next)))))
-
-(defun notmuch-show-add-tag-thread (tag)
- "Add tag to all messages in the current thread."
- (interactive)
- (notmuch-show-tag-thread-internal tag))
-
-(defun notmuch-show-remove-tag-thread (tag)
- "Remove tag from all messages in the current thread."
- (interactive)
- (notmuch-show-tag-thread-internal tag t))
-
(defun notmuch-show-next-thread (&optional show-next)
"Move to the next item in the search results, if any."
(interactive "P")
@@ -1645,9 +1625,8 @@ being delivered to the same thread. It does not archive the
entire thread, but only the messages shown in the current
buffer."
(interactive "P")
- (if unarchive
- (notmuch-show-add-tag-thread "inbox")
- (notmuch-show-remove-tag-thread "inbox")))
+ (let ((op (if unarchive "+" "-")))
+ (notmuch-show-tag-all (concat op "inbox"))))
(defun notmuch-show-archive-thread-then-next ()
"Archive each message in thread, then show next thread from search."
--
1.7.9
next reply other threads:[~2012-02-08 16:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 16:48 Dmitry Kurochkin [this message]
2012-02-09 7:54 ` [PATCH] emacs: cleanup and simplify `notmuch-show-archive-thread' and related functions Tomi Ollila
2012-02-09 8:10 ` David Edmondson
2012-02-12 18:08 ` David Bremner
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=1328719731-13402-1-git-send-email-dmitry.kurochkin@gmail.com \
--to=dmitry.kurochkin@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).