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

* Re: notmuch and "mute" -- useful to anyone?
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Amadeusz Żołnowski @ 2016-08-02 19:28 UTC (permalink / raw)
  To: Matt Armstrong; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 3201 bytes --]

This seems to be something that https://github.com/teythoon/afew already
does, although it uses tag 'killed' instead. I think that alot e-mail
client uses 'killed' tag as well. Maybe you could consider having that
name instead or make it configurable with 'killed' as default?

Cheers,

-- Amadeusz Żołnowski

Matt Armstrong <marmstrong@google.com> writes:

> 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)
> ----------------------------------------------------------------------
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 950 bytes --]

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

* Re: notmuch and "mute" -- useful to anyone?
  2016-08-02 17:39 notmuch and "mute" -- useful to anyone? Matt Armstrong
  2016-08-02 19:28 ` Amadeusz Żołnowski
@ 2016-08-02 22:32 ` David Bremner
  2016-08-03 17:33   ` Matt Armstrong
  1 sibling, 1 reply; 5+ messages in thread
From: David Bremner @ 2016-08-02 22:32 UTC (permalink / raw)
  To: Matt Armstrong, notmuch

Matt Armstrong <marmstrong@google.com> writes:

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

See also the example of https://notmuchmail.org/excluding/

This kind of thing is what message exclusion is invented for.

I guess you have to adjust to get precisely the semantics you want where
messages specifically to you are not muted.

By the way, also in git master you can used saved queries instead of
tag:me. So

notmuch config query.me "to:matt@gmail.com or to matt@sekritaddress.net"

then use e.g. "tag:muted and query:me" in your example.

That again requires xapian 1.3+

d

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

* Re: notmuch and "mute" -- useful to anyone?
  2016-08-02 19:28 ` Amadeusz Żołnowski
@ 2016-08-03  9:42   ` Charlie Allom
  0 siblings, 0 replies; 5+ messages in thread
From: Charlie Allom @ 2016-08-03  9:42 UTC (permalink / raw)
  To: Amadeusz Żołnowski, Matt Armstrong; +Cc: notmuch

On Tue, Aug 02 2016 at 08:28:38 PM, Amadeusz Żołnowski <aidecoe@aidecoe.name> wrote:

> [ Unknown signature status ]
> This seems to be something that https://github.com/teythoon/afew already
> does, although it uses tag 'killed' instead. I think that alot e-mail
> client uses 'killed' tag as well. Maybe you could consider having that
> name instead or make it configurable with 'killed' as default?

I'd prefer fewer things to maintain, so prefer the notmuch+emacs method
rather than adding in afew or more scripts.

Matt keep it coming or at least put it on github somewhere for us :)

  C.
-- 

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

* Re: notmuch and "mute" -- useful to anyone?
  2016-08-02 22:32 ` David Bremner
@ 2016-08-03 17:33   ` Matt Armstrong
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Armstrong @ 2016-08-03 17:33 UTC (permalink / raw)
  To: David Bremner, notmuch

David Bremner <david@tethera.net> writes:

> Matt Armstrong <marmstrong@google.com> writes:
>
>> 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 --
>> ----------------------------------------------------------------------
>
> See also the example of https://notmuchmail.org/excluding/
>
> This kind of thing is what message exclusion is invented for.
>
> I guess you have to adjust to get precisely the semantics you want where
> messages specifically to you are not muted.

"mute" is a bit odd.  It is essentially "new messages in this thread
skip the inbox".  It is a property of a thread, not a message.

It has little to do with excluding messages from arbitrary searches.  In
particular, muted threads should show up in normal free text searches.
I don't think message exclusion is the right mechanism.

The spec is: when a message arrives,
  if it is "to me" unmute any thread it is part of
  otherwise if it is in a muted thread, avoid tagging it "inbox"

This is a little bit hard to deal with in a the notmuch model, which
deals more naturally with mechanisms that tag individual messages and
handles threading as a post-search message gathering step (as far as I
can tell).

I'm not claiming that what I've got is optimal -- it feels like a hack
to me, but is the best I came up with.

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