[Emacs] Update mu4e bookmarks, simplify code

This commit is contained in:
Lucien Cartier-Tilet 2022-01-04 18:16:34 +01:00
parent b366894391
commit 184731f105
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -1606,6 +1606,19 @@ Paris 8 (my university).
" OR ")
#+end_src
#+name: mu4e-bookmarks-mailing-lists
#+headers: :tangle no :exports none
#+begin_src emacs-lisp :var lists=mu4e-emacs-mailing-lists
(mapconcat (lambda (list)
(let ((address (string-replace (regexp-quote "~") "" (car list))))
(mapconcat (lambda (flag)
(concat flag ":" address))
'("list" "t" "f")
" OR ")))
lists
" OR ")
#+end_src
#+name: mu4e-bookmarks-filter-uni
#+headers: :tangle no :cache yes
#+begin_src emacs-lisp
@ -1624,58 +1637,57 @@ Next I need an inbox dedicated to the association Im part of.
<<mu4e-bookmarks-from-copy-to-gen>>)
#+end_src
#+RESULTS[981592042b62118e3bb82ce802bdfe9647a200c7]: mu4e-bookmarks-filter-asso
#+RESULTS[e04566a9d56624e063b3dd4e2c639e87cf9683aa]: mu4e-bookmarks-filter-asso
: f:/.*supran\.fr/ OR c:/.*supran\.fr/ OR t:/.*supran\.fr/
As for the Emacs-doctor list, I need to match both the current, modern
mailing list address but also its old address. The same applies for
the emacs-devel mailing list.
the emacs-devel mailing list as well as Github emails related to my
package ~eshell-info-banner.el~ ([[#Packages-Configuration-Emacs-built-ins-Eshell-Visual-configuratione7c2fl6184j0][see here]]). Here are the addresses to
match:
#+name: mu4e-emacs-mailing-lists
- ~/ateliers.*emacs.*/~
- ~/emacs-.*@gnu.org/~
- ~/.*eshell-info-banner.*/~
#+name: mu4e-bookmarks-filter-emacs-list
#+headers: :tangle no :cache yes
#+begin_src emacs-lisp
(mapconcat (lambda (address)
(mapconcat (lambda (flag)
(concat flag ":" address))
'("list" "t" "f")
" OR "))
'("ateliers-emacs.framalistes.org" "ateliers-paris.emacs-doctor.com" "/emacs-devel.*@gnu.org/")
" OR ")
"<<mu4e-bookmarks-mailing-lists(lists=mu4e-emacs-mailing-lists)>>"
#+end_src
#+RESULTS[dea2fe3f21169f2a84823a4e07fd3f4982cbe01f]: mu4e-bookmarks-filter-emacs-list
: list:ateliers-emacs.framalistes.org OR t:ateliers-emacs.framalistes.org OR f:ateliers-emacs.framalistes.org OR list:ateliers-paris.emacs-doctor.com OR t:ateliers-paris.emacs-doctor.com OR f:ateliers-paris.emacs-doctor.com OR list:/emacs-devel.*@gnu.org/ OR t:/emacs-devel.*@gnu.org/ OR f:/emacs-devel.*@gnu.org/
#+RESULTS[e1bbf093d76cce7ac111b2521e02a2007d9cb3c5]: mu4e-bookmarks-filter-emacs-list
: list:/ateliers.*emacs.*/ OR t:/ateliers.*emacs.*/ OR f:/ateliers.*emacs.*/ OR list:/emacs-.*@gnu.org/ OR t:/emacs-.*@gnu.org/ OR f:/emacs-.*@gnu.org/ OR list:/.*eshell-info-banner.*/ OR t:/.*eshell-info-banner.*/ OR f:/.*eshell-info-banner.*/
Another bookmark I wish to have is one dedicated to emails related to
issues and PRs from Github.
#+name: mu4e-github-mailing-lists
- ~/.*\\.github\\.com/~
#+name: mu4e-bookmarks-filter-github-list
#+headers: :tangle no :cache yes
#+begin_src emacs-lisp
(mapconcat #'identity
'("list:/.*\\.github\\.com/"
"to:/.*noreply\\.github\\.com/")
" OR ")
"<<mu4e-bookmarks-mailing-lists(lists=mu4e-github-mailing-lists)>>"
#+end_src
#+RESULTS[024adbd8fb765cf06d160c715ceb364dd3a94e89]: mu4e-bookmarks-filter-github-list
: list:/.*\.github\.com/ OR to:/.*noreply\.github\.com/
#+RESULTS[243cc8fb9d993a330623ae38ba2cb08df6862562]: mu4e-bookmarks-filter-github-list
: list:/.*\.github\.com/ OR t:/.*\.github\.com/ OR f:/.*\.github\.com/
When it comes to the conlang mailing list, lets not match anything
from or to them. Ill also include the auxlang mailing list Im not
subscribed anymore, but itll keep my inbox clean.
#+name: mu4e-conlanging-mailing-lists
- ~/.*LANG@LISTSERV.BROWN.EDU/~
#+name: mu4e-bookmarks-filter-conlang-list
#+headers: :tangle no :cache yes
#+begin_src emacs-lisp
(mapconcat (lambda (address)
(mapconcat (lambda (flag)
(concat flag ":" address))
'("f" "t" "list")
" OR "))
'("CONLANG@LISTSERV.BROWN.EDU" "AUXLANG@LISTSERV.BROWN.EDU")
" OR ")
"<<mu4e-bookmarks-mailing-lists(lists=mu4e-conlanging-mailing-lists)>>"
#+end_src
#+RESULTS[8b8e964b9777bc1d98542218d79a3537283ac03c]: mu4e-bookmarks-filter-conlang-list
: f:CONLANG@LISTSERV.BROWN.EDU OR t:CONLANG@LISTSERV.BROWN.EDU OR list:CONLANG@LISTSERV.BROWN.EDU OR f:AUXLANG@LISTSERV.BROWN.EDU OR t:AUXLANG@LISTSERV.BROWN.EDU OR list:AUXLANG@LISTSERV.BROWN.EDU
#+RESULTS[4c4f91412e120fb1f69388371d2b4db3db7db061]: mu4e-bookmarks-filter-conlang-list
: list:/.*LANG@LISTSERV.BROWN.EDU/ OR t:/.*LANG@LISTSERV.BROWN.EDU/ OR f:/.*LANG@LISTSERV.BROWN.EDU/
As I said earlier, something that will often come back in my bookmarks
is the emails must not be trashed to appear. I want also to display
@ -1712,12 +1724,12 @@ And for the last string-generating code, lets describe my main inbox:
" AND NOT ")
#+end_src
#+RESULTS[717441df74baa865c06f852f92aab4e96c41b203]: mu4e-bookmarks-inbox-filters
: NOT flag:trashed AND (maildir:/Inbox OR maildir:/Junk) AND NOT (f:CONLANG@LISTSERV.BROWN.EDU OR t:CONLANG@LISTSERV.BROWN.EDU OR list:CONLANG@LISTSERV.BROWN.EDU OR f:AUXLANG@LISTSERV.BROWN.EDU OR t:AUXLANG@LISTSERV.BROWN.EDU OR list:AUXLANG@LISTSERV.BROWN.EDU) AND NOT (f:/.*supran.fr/ OR c:/.*supran.fr/ OR t:/.*supran.fr/) AND NOT (list:ateliers-emacs.framalistes.org OR t:ateliers-emacs.framalistes.org OR f:ateliers-emacs.framalistes.org OR list:ateliers-paris.emacs-doctor.com OR t:ateliers-paris.emacs-doctor.com OR f:ateliers-paris.emacs-doctor.com OR list:/emacs-devel.*@gnu.org/ OR t:/emacs-devel.*@gnu.org/ OR f:/emacs-devel.*@gnu.org/) AND NOT (list:/.*\.github\.com/ OR to:/.*noreply\.github\.com/) AND NOT (f:/.*up8\.edu|.*univ-paris8.*/ OR c:/.*up8\.edu|.*univ-paris8.*/ OR t:/.*up8\.edu|.*univ-paris8.*/)
#+RESULTS[b1ab5c3978fb3eb1070980a7cd2277c418a8f822]: mu4e-bookmarks-inbox-filters
: NOT flag:trashed AND (maildir:/Inbox OR maildir:/Junk) AND NOT (list:/.*LANG@LISTSERV.BROWN.EDU/ OR t:/.*LANG@LISTSERV.BROWN.EDU/ OR f:/.*LANG@LISTSERV.BROWN.EDU/) AND NOT (f:/.*supran.fr/ OR c:/.*supran.fr/ OR t:/.*supran.fr/) AND NOT (list:/ateliers.*emacs.*/ OR t:/ateliers.*emacs.*/ OR f:/ateliers.*emacs.*/ OR list:/emacs-.*@gnu.org/ OR t:/emacs-.*@gnu.org/ OR f:/emacs-.*@gnu.org/ OR list:/.*eshell-info-banner.*/ OR t:/.*eshell-info-banner.*/ OR f:/.*eshell-info-banner.*/) AND NOT (list:/.*\.github\.com/ OR t:/.*\.github\.com/ OR f:/.*\.github\.com/) AND NOT (f:/.*up8\.edu|.*univ-paris8.*/ OR c:/.*up8\.edu|.*univ-paris8.*/ OR t:/.*up8\.edu|.*univ-paris8.*/)
We can finally define our bookmarks! The code reads as follows:
#+name: mu4e-bookmarks
#+begin_src emacs-lisp :tangle no :cache yes
#+begin_src emacs-lisp :tangle no :cache yes :results none
(setq mu4e-bookmarks
`((:name "Inbox"
:key ?i
@ -1745,7 +1757,7 @@ We can finally define our bookmarks! The code reads as follows:
"<<mu4e-bookmarks-filter-github-list()>>"))
(:name "Linguistics"
:key ?l
:query ,(format "%s AND %s"
:query ,(format "(%s) AND (%s)"
"<<mu4e-bookmarks-default-filter()>>"
<<mu4e-bookmarks-filter-conlang-list>>))
(:name "Sent" :key ?s :query "maildir:/Sent")
@ -1756,20 +1768,6 @@ We can finally define our bookmarks! The code reads as follows:
(:name "This Year" :key ?y :query "date:1y..now AND NOT flag:trashed")))
#+end_src
#+RESULTS[cd432f1d0fb976a586c4b4bff1f9faca67a05f12]: mu4e-bookmarks
| :name | Inbox | :key | 105 | :query | NOT flag:trashed AND (maildir:/Inbox OR maildir:/Junk) AND NOT (f:CONLANG@LISTSERV.BROWN.EDU OR t:CONLANG@LISTSERV.BROWN.EDU OR list:CONLANG@LISTSERV.BROWN.EDU OR f:AUXLANG@LISTSERV.BROWN.EDU OR t:AUXLANG@LISTSERV.BROWN.EDU OR list:AUXLANG@LISTSERV.BROWN.EDU) AND NOT (f:/.*supran.fr/ OR c:/.*supran.fr/ OR t:/.*supran.fr/) AND NOT (list:ateliers-emacs.framalistes.org OR t:ateliers-emacs.framalistes.org OR f:ateliers-emacs.framalistes.org OR list:ateliers-paris.emacs-doctor.com OR t:ateliers-paris.emacs-doctor.com OR f:ateliers-paris.emacs-doctor.com OR list:/emacs-devel.*@gnu.org/ OR t:/emacs-devel.*@gnu.org/ OR f:/emacs-devel.*@gnu.org/) AND NOT (list:/.*\.github\.com/ OR to:/.*noreply\.github\.com/) AND NOT (f:/.*up8\.edu | .*univ-paris8.*/ OR c:/.*up8\.edu | .*univ-paris8.*/ OR t:/.*up8\.edu | .*univ-paris8.*/) |
| :name | University | :key | 117 | :query | NOT flag:trashed AND (maildir:/Inbox OR maildir:/Junk) AND f:/.*up8.edu | .*univ-paris8.*/ OR c:/.*up8.edu | .*univ-paris8.*/ OR t:/.*up8.edu | .*univ-paris8.*/ |
| :name | Supran | :key | 83 | :query | NOT flag:trashed AND (maildir:/Inbox OR maildir:/Junk) AND f:/.*supran.fr/ OR c:/.*supran.fr/ OR t:/.*supran.fr/ | | | |
| :name | Emacs | :key | 101 | :query | NOT flag:trashed AND (maildir:/Inbox OR maildir:/Junk) AND list:ateliers-emacs.framalistes.org OR t:ateliers-emacs.framalistes.org OR f:ateliers-emacs.framalistes.org OR list:ateliers-paris.emacs-doctor.com OR t:ateliers-paris.emacs-doctor.com OR f:ateliers-paris.emacs-doctor.com OR list:/emacs-devel.*@gnu.org/ OR t:/emacs-devel.*@gnu.org/ OR f:/emacs-devel.*@gnu.org/ | | | |
| :name | Github | :key | 103 | :query | NOT flag:trashed AND (maildir:/Inbox OR maildir:/Junk) AND (list:/.*.github.com/ OR to:/.*noreply.github.com/) | | | |
| :name | Linguistics | :key | 108 | :query | NOT flag:trashed AND (maildir:/Inbox OR maildir:/Junk) AND f:CONLANG@LISTSERV.BROWN.EDU OR t:CONLANG@LISTSERV.BROWN.EDU OR list:CONLANG@LISTSERV.BROWN.EDU OR f:AUXLANG@LISTSERV.BROWN.EDU OR t:AUXLANG@LISTSERV.BROWN.EDU OR list:AUXLANG@LISTSERV.BROWN.EDU | | | |
| :name | Sent | :key | 115 | :query | maildir:/Sent | | | |
| :name | All Unread | :key | 85 | :query | flag:unread AND NOT flag:trashed | | | |
| :name | Today | :key | 116 | :query | date:today..now AND NOT flag:trashed | | | |
| :name | This Week | :key | 119 | :query | date:7d..now AND NOT flag:trashed | | | |
| :name | This Month | :key | 109 | :query | date:1m..now AND NOT flag:trashed | | | |
| :name | This Year | :key | 121 | :query | date:1y..now AND NOT flag:trashed | | | |
***** Dealing with spammers
:PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Applications-Email-Mu4e-Dealing-with-spammers-tid4mw51l7j0