help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gmail’s \Muted label in Gnus


From: Nikolai Weibull
Subject: Re: Gmail’s \Muted label in Gnus
Date: Sat, 9 Jan 2016 10:11:57 +0100

On Sat, Jan 9, 2016 at 9:58 AM, Lars Magne Ingebrigtsen <address@hidden> wrote:
> Nikolai Weibull <address@hidden> writes:
>
>> Has anyone written any functionality for setting Gmail’s \Muted label
>> from Gnus?  I’d like to be able to mute threads in Gmail from Gnus,
>> but before I learn the inner workings of Gnus and nnimap I figured I’d
>> check if anyone’s already done the work.
>
> I don't think anybody's implemented support for \Muted in Gnus, but it
> sounds like a useful thing to have.

I actually figured it out, sort of.  I’m sure there are better ways of
handling it, perhaps the + and - should be sent using
nnimap-send-command, but this, at least, works.  As only muting part
of a thread will confuse Gmail, we select all articles belonging to a
thread that in one way or another has been included by
gnus-summary-work-articles.  Then we add \Muted and remove \Inbox.
Finally, to make it clear that something happened in Gnus, we kill the
thread.  It’d perhaps be better if we could use a custom mark, but I
couldn’t figure out if that was OK to do.

(defun now-gnus-summary-mute-articles (n)
  (interactive "P")
  (let (articles root-articles)
    (dolist (article (gnus-summary-work-articles n))
      (unless (member article articles)
        (let ((parent (gnus-summary-article-parent article)))
          (while parent
            (setq article parent)
            (setq parent (gnus-summary-article-parent parent))))
        (push article root-articles)
        (if articles
            (nconc articles (gnus-summary-articles-in-thread article))
          (setq articles (gnus-summary-articles-in-thread article)))))
    (sort articles '<)
    (when (and articles
               (with-current-buffer (nnimap-buffer)
                 (and (nnimap-command "UID STORE %s +X-GM-LABELS (\\Muted)"
                                      (nnimap-article-ranges articles))
                      (nnimap-command "UID STORE %s -X-GM-LABELS (\\Inbox)"
                                      (nnimap-article-ranges articles)))))
      (apply 'gnus-summary-remove-process-mark articles)
      (dolist (article (nreverse root-articles))
        (gnus-summary-goto-subject article)
        (gnus-summary-kill-thread)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]