Toggling multiple index_format or limits

Kevin J. McCarthy kevin at 8t8.us
Tue Aug 4 02:14:54 UTC 2020


[I'm moving this into a separate thread, because it doesn't directly 
help Leho.]

Here's a little bit of new functionality I've added to master for the 
next release.  I just wanted to give a peek.  (Both require enabling 
$muttlisp_inline_eval).

Three-way $index_format toggle.  (The index-format-hook is extraneous 
but I'm copying from my muttrc here:)

set my_idx1 = "%Z %-20.20F %s %*  (%c) %@reldate@"
set my_idx2 = "%Z %-20.20F %s %*  %@reldate@"
set my_idx3 = "%4C %[!%a %x %X]  %-15.15F %Z (%4c) %s"
set index_format = $my_idx1

index-format-hook  reldate  "%d<24H"  "%[!%X]"
index-format-hook  reldate  "~A"     "%[!%x]"

macro index i '<enter-command>set index_format =  \
   (or                                             \
     (if (equal $index_format $my_idx1) $my_idx2)  \
     (if (equal $index_format $my_idx2) $my_idx3)  \
     $my_idx1) \
<enter>'


Here's a possible 6-way toggle of date-limiting, along with an echo 
afterwards.

set my_limall = "~A"
set my_lim1 = "~d >2w"          # older than two weeks
set my_lim2 = "~d <2w ~d >1w"   # two weeks ago
set my_lim3 = "~d <1w"          # last week
set my_lim4 = "~d <2d ~d >1d"   # yesterday
set my_lim5 = "~d <1d"          # today
folder-hook . "set my_curlim = $my_limall"

macro index ,t '<enter-command>set my_curlim =  \
   (or                                           \
     (if (equal $my_curlim $my_limall) $my_lim1) \
     (if (equal $my_curlim $my_lim1)   $my_lim2) \
     (if (equal $my_curlim $my_lim2)   $my_lim3) \
     (if (equal $my_curlim $my_lim3)   $my_lim4) \
     (if (equal $my_curlim $my_lim4)   $my_lim5) \
     $my_limall)                                 \
<enter>\
<enter-command>push (concat "<" "limit" ">" $my_curlim "<" "enter" ">")<enter>\
<enter-command>echo (concat "limit set to: " $my_curlim)<enter>'

-- 
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/20200803/dc98cf22/attachment.asc>


More information about the Mutt-users mailing list