mu4e: handle conversion from pcre regexps

mu server uses PCRE-compatible regular expressions, but mu4e needs
Emacs-style. In simple cases, the two are the same, but when it gets
slightly more complicated they do not.

E.g.,
  (foo|bar) => \(foo\|bar\)

Mu4e can do the conversion automatically, but for this the pcre2el
package (available in MELPA) is required, and is used if user installs
is. Anyway, this code implements the automatic conversion and adds some
documentation.

Fixes #2816.
This commit is contained in:
Dirk-Jan C. Binnema
2025-02-16 17:25:57 +02:00
parent 7baf1bf5e5
commit 3dbd8b9763
5 changed files with 87 additions and 19 deletions

View File

@ -39,6 +39,15 @@ _email-address-or-regex_ can be either a plain e-mail address (such as
for details), wrapped in */* (such as =/foo-.*@example\\.com/=). Depending on your
shell, the argument may need to be quoted.
A note of warning for *mu4e* users: any regular-expressions used with
=--with-address= are also used by *mu4e*. Unfortunately, PCRE regular expressions
are *not* generally compatible with Emacs regular expressions. For instance,
*(foo|bar)* in PCRE syntax has *\(foo\|bar\)* as its Emacs equivalent.
The good news is that *mu4e* can automatically translate the regular-expressions,
if you allow it to, by installing the *pcre2el* Elisp package. See the *mu4e*
documentation for further details.
** --ignored-address _email-address-or-regex_
Specifies that some e-mail address is to be ignored from the contacts-cache (the
option can be used multiple times). Such addresses then cannot be found with