unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Matt Armstrong <marmstrong@google.com>
To: notmuch@notmuchmail.org
Subject: notmuch and "mute" -- useful to anyone?
Date: Tue, 02 Aug 2016 10:39:41 -0700	[thread overview]
Message-ID: <qf5vazjjciq.fsf@marmstrong-linux.kir.corp.google.com> (raw)

Is anyone else interested in Gmail-like "mute" support in notmuch.el?
If so, I can think about polishing the below off and adding it to
notmuch.

I've managed to implement Gmail's "mute" in notmuch as follows in my
notmuch-post-new:

----------------------------------------------------------------------
# Unmute all threads with new messages sent to me.
notmuch search --output=threads tag:new AND tag:me | \
  xargs --no-run-if-empty notmuch tag -muted --

# Remove all muted threads from the inbox and mark every message in them
# muted.  Ideally this would be atomic with the above.
notmuch search --output=threads tag:muted | \
  xargs --no-run-if-empty notmuch tag -inbox +muted --
----------------------------------------------------------------------

Then in .emacs:

----------------------------------------------------------------------
(defcustom my-notmuch-mute-tags '("+muted" "-inbox")
  "List of tag changes to apply to a message or a thread when it is muted.

Tags starting with \"+\" (or not starting with either \"+\" or
\"-\") in the list will be added, and tags starting with \"-\"
will be removed from the message or thread being archived.

For example, if you wanted to remove an \"inbox\" tag and add an
\"archived\" tag, you would set:
    (\"-inbox\" \"+archived\")"
  :type '(repeat string)
  :group 'notmuch-search
  :group 'notmuch-show)

;; TODO: consider defadvice?
(defun my-notmuch-search-mute-thread (&optional unarchive beg end)
  "Mute the currently selected thread or region.

Mute  each message in the currently selected thread by applying the
tag changes in `my-notmuch-mute-tags' to each (remove the \"inbox\"
tag by default). If a prefix argument is given, the messages will
be \"unarchived\" (i.e. the tag changes in `my-notmuch-mute-tags'
will be reversed).

This function advances the next thread when finished."
  (interactive (cons current-prefix-arg (notmuch-search-interactive-region)))
  (let ((notmuch-archive-tags my-notmuch-mute-tags))
    (notmuch-search-archive-thread unarchive beg end)))

(defun my-notmuch-show-mute-thread-then-next ()
  (interactive)
  "Mute all messages in the current buffer, then show next thread from search."
  (let ((notmuch-archive-tags my-notmuch-mute-tags))
    (notmuch-show-archive-thread-then-next)))

(define-key notmuch-search-mode-map "m" 'my-notmuch-search-mute-thread)
(define-key notmuch-show-mode-map "m" 'my-notmuch-show-mute-thread-then-next)
----------------------------------------------------------------------

             reply	other threads:[~2016-08-02 17:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 17:39 Matt Armstrong [this message]
2016-08-02 19:28 ` notmuch and "mute" -- useful to anyone? Amadeusz Żołnowski
2016-08-03  9:42   ` Charlie Allom
2016-08-02 22:32 ` David Bremner
2016-08-03 17:33   ` Matt Armstrong

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=qf5vazjjciq.fsf@marmstrong-linux.kir.corp.google.com \
    --to=marmstrong@google.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).