conditional index_format

Kevin J. McCarthy kevin at 8t8.us
Wed Jun 10 16:58:05 UTC 2020


On Wed, Jun 10, 2020 at 04:11:58PM +0200, steve wrote:
>When forwarding a message to recipient R, that message is listed as the
>author (me) since I defined $index_format with the %n variable. This is
>fine when I create a message or reply to a message, but it would be more
>convenient to see the recipient's name when I forward a message.
>
>So is it possible to have $index_format reflect this?

Starting in Mutt 1.11.0, there is index-format-hook and the %@name@ 
expando.  See <http://www.mutt.org/doc/manual/#index-format-hook>

You might be able to do something like:

   set index_format="%4C %Z %4c %d    %-22.27 at recip@ %2X %s"

   index-format-hook  recip  "~P ~s '^Fwd:'"  "%t"
   index-format-hook  recip  "~A"             "%n"

The first assumes a 'set forward_format="Fwd: %s"' which is a bit easier 
to match via regexp than the default value "[%a: %s]".  Otherwise the 
matching would be a bit less accurate.  Maybe something like:

   index-format-hook  recip  "~P ~s '^\\[.*\\]$'"  "%t"

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-users/attachments/20200610/1b01d67a/attachment.asc>


More information about the Mutt-users mailing list