[MlMt] Help for a command : )

Benny Kjær Nielsen mailinglist at freron.com
Fri Feb 12 03:29:05 EST 2016


On 11 Feb 2016, at 14:42, Ale Muñoz wrote:

> Here's what I want to do:
>
> - Take the subject from the selected email
> - Extract some information from it using a RegExp
> - Search the current mailbox for all emails that contain that RegExp 
> and delete them
>
> Any ideas? Thanks in advance! : )

This is actually possible using custom key bindings, but it appears it's 
only documented in some very old release notes. I've noted to make sure 
it's documented:

Here is an example:

	( "selectWithFilter:", "subject ~ '${subject/[^\\d]*(\\d+).*/$1/}'", 
"deleteMessage:" );

In this case I'm extracting the first number found in the subject line 
of the currently selected message. All subject lines in the current 
mailbox are then searched for the same number.

Observations:

* It's tricky to debug. I suggest using the format/regexp string for one 
of the menu bar counters until the menu displays the values you need to 
extract. Then make sure you escape (add another `\`) any uses of `\` 
before adding it to the key bindings file.
* It's badly named. It should be `selectWithFormatString:`. I've added 
that this also works.
* It doesn't allow you switch mailbox before selecting messages (not 
easily fixed).
* The above example would also match on substrings of numbers.

But it seems it should work for you.

-- 
Benny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20160212/1aa54ba4/attachment.html>


More information about the mailmate mailing list