[MlMt] Counter format syntax

Henry Seiden info at techworkspro.com
Sun Jul 24 08:49:54 EDT 2022


I had this question, too. Thanks for the tutorial, Benny.

Respectfully,

Henry Seiden
- -
Techworks Pro Co.
E: info<at>techworkspro<dot>com
W: http://techworkspro.com

On 16 Jul 2022, at 9:26, Benny Kjær Nielsen wrote:

> On 16 Jul 2022, at 14:44, David Wainberg wrote:
>
>> One thing I want to fix is the format of the information behind a 
>> counter dropdown. The documentation of the format syntax is pretty 
>> sparse - https://manual.mailmate-app.com/format_string_syntax.html - 
>> and I'm having trouble figuring it out.
>
> Very understandable.
>
>> Specifically, what I want to do at the moment is to shorten and fix 
>> the length of the subject display, since by default it is variable, 
>> and some email subjects are quite long. The size and positioning of 
>> the dropdown adjusts accordingly, which I find undesirable.
>
> That could be something like this (using regular expressions):
>
>     ${subject/(.{,10})(.+)?/$1(?2:…)/}
>
> That looks pretty menacing, but it's the same syntax as provided by 
> some text editors when doing search/replace. The MailMate syntax is 
> identical to the one used by TextMate. That means the documentation 
> found 
> [here](https://macromates.com/manual/en/regular_expressions#conditional_insertions) 
> is also useful for MailMate (and the example is more advanced than the 
> one provided here).
>
> To elaborate, this is the format string variant used above:
>
>     ${«var»/«regexp»/«format»/«options»}
>
> The `var` is `subject`, but this could be any email header (or a 
> subpart of a header).
>
> The `regexp` is:
>
>     (.{,10})(.+)?
>
> It matches 10 characters and then the rest in 2 different capture 
> variables.
>
> The `format` used is then:
>
>     $1(?2:…)
>
> Which simply uses the (up to) 10 characters in the first capture and 
> then adds the ellipsis if and only if the second capture contains 
> anything.
>
>> Even if that's not doable, I'd like to play with the format.
>>
>> I've searched the list and haven't found anything. Can anyone point 
>> me to more docs or examples I can crib from?
>
> The above isn't much, but maybe it'll help a bit.
>
> -- 
> Benny

> _______________________________________________
> mailmate mailing list
> mailmate at lists.freron.com
> https://lists.freron.com/listinfo/mailmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20220724/5f0716e4/attachment.htm>


More information about the mailmate mailing list