all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Filipp Gunbin <fgunbin@fastmail.fm>
To: Rodrigo Morales <moralesrodrigo1100@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: [gnus] How to show mails from an specific mailing list?
Date: Tue, 22 Jun 2021 16:30:17 +0300	[thread overview]
Message-ID: <m2k0mm2fiu.fsf@fastmail.fm> (raw)
In-Reply-To: <87mtri1lwk.fsf@gmail.com> (Rodrigo Morales's message of "Tue, 22 Jun 2021 00:57:47 -0500")

On 22/06/2021 00:57 -0500, Rodrigo Morales wrote:

> I sometimes want to read mails from an specific mailing list. However,
> since I'm on multiple mailing lists, the Summary buffer show messages
> from all mailing lists. My question is: Is there any way to make Gnus
> show messages from a given mailing list?

I use client splitting and a mapping file, like this.

File contains lines like:

ml.auctex auctex@gnu.org
ml.auctex-devel auctex-devel@gnu.org
ml.bash-announce bash-announce@gnu.org
ml.bash-bug bug-bash@gnu.org

Then in .gnus.el I do:

(let ((mail-lists (fg-dotemacs-read-group-to-email
                   "~/file.txt")))
  (setq nnmail-split-methods
        (nconc
         ;; <any rules before...>
         ;;
         ;; mail list to group:
         (mapcar (lambda (list)
                   (list (car list)
                         (concat "\\(From\\|To\\):.*\\<" (cadr list) "\\>")))
                 mail-lists)
         ;;
         ;; <any rules after...>
         )))

Supporting functions:

(defun fg-dotemacs-read-group-to-email (file)
  "Read mappings from FILE and return list of entries (GROUP-NAME
EMAIL).  Each line should be like: 'ml.my-list
my-list@example.org', email is treated as literal and
regexp-quoted."
  (mapcar (lambda (list)
            (if (= (length list) 2)
                (list (car list) (regexp-quote (cadr list)))
              (error "Invalid line: %S" list)))
          (mapcar #'split-string
                  (fg-dotemacs-read-lines file))))

(defun fg-dotemacs-read-lines (file)
  "Returns all non-blank lines of FILE as a list of strings.
Leading and trailing whitespace is trimmed off.  If the first
non-whitespace character on a line is '#' then the line is
treated as comment and skipped."
  (let (res)
    (with-temp-buffer
      (insert-file-contents (expand-file-name file))
      (while (not (eobp))
        (beginning-of-line)
        (unless (looking-at "[ \t]*$\\|[ \t]*#")
          (push (string-trim
                 (buffer-substring (point) (line-end-position)))
                res))
        (forward-line)))
    (nreverse res)))

There's also "fancy splitting", you can read about it in (info "(gnus)
Fancy Mail Splitting"), I haven't checked it yet.

Filipp



  parent reply	other threads:[~2021-06-22 13:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  5:57 [gnus] How to show mails from an specific mailing list? Rodrigo Morales
2021-06-22  8:30 ` Daniel Martín
2021-06-22  8:31 ` Eric S Fraga
2021-06-22 13:30 ` Filipp Gunbin [this message]
2021-06-26  0:01 ` Emanuel Berg via Users list for the GNU Emacs text editor

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2k0mm2fiu.fsf@fastmail.fm \
    --to=fgunbin@fastmail.fm \
    --cc=help-gnu-emacs@gnu.org \
    --cc=moralesrodrigo1100@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.