unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* notmuch and "mute" -- useful to anyone?
@ 2016-08-02 17:39 Matt Armstrong
  2016-08-02 19:28 ` Amadeusz Żołnowski
  2016-08-02 22:32 ` David Bremner
  0 siblings, 2 replies; 5+ messages in thread
From: Matt Armstrong @ 2016-08-02 17:39 UTC (permalink / raw)
  To: notmuch

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)
----------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-03 17:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-02 17:39 notmuch and "mute" -- useful to anyone? Matt Armstrong
2016-08-02 19:28 ` Amadeusz Żołnowski
2016-08-03  9:42   ` Charlie Allom
2016-08-02 22:32 ` David Bremner
2016-08-03 17:33   ` Matt Armstrong

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).