[MlMt] Counter format syntax
Benny Kjær Nielsen
mailinglist at freron.com
Sat Jul 16 09:26:58 EDT 2022
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20220716/4c3dffb2/attachment.htm>
More information about the mailmate
mailing list