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

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

Re: cleaning up a big regexp


From: Eric Abrahamsen
Subject: Re: cleaning up a big regexp
Date: Mon, 15 Sep 2014 19:25:23 +0800
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux)

torys.anderson@gmail.com (Tory S. Anderson) writes:

> Using gnus I have a growing regexp that represents the criteria for bulk 
> email and splits accordingly:
>
> (setq my-gnus-bulk-regexp 
> "\\(^From:.*\\(@maillist.codeproject.com\\|@papajohns-specials.com\\|@qomail.quikorder.com\\|@linkedin.com\\|@facebookmail.com\\|@plus.google.com\\|@twitter.com\\|@youtube.com\\|@linguistlist.org\\|sportsauthority.com\\)\\)\\|\\(^To:.*torysanderson@gmail.com\\)")
>
> ;; TODO make bulk-list
> (setq nnmail-split-methods
>        '(("mail.bulk" my-gnus-bulk-regexp)
>         ...
>  
>
> Is there a way to clean this up to make it both more readable and more easily 
> editable? It seems like keeping some kind of list would be the way to do it, 
> instead of an ever-lengthening string. 

Check out the regexp-opt function, which takes an arbitrary number of
strings and gloms them into a big regexp. At least it looks nicer in
your .gnus.el file.




reply via email to

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