On Tue, Dec 06, 2022 at 12:24:58AM +0100, Andy Spiegl wrote:
I'm trying to bind the "j" key to the function "sidebar-next" if the sidebar is 
visible.
The only doable way seems to be using muttlisp.
I tried to follow the example in the mutt manual but I'm failing to write this 
tiny piece of lisp code.
Could someone help me please to correct the follwing?
Or maybe there is a better/easier way to do this?

--------------------------------------------------------------
# sidebar     visible  -->  bind index j next-undeleted
# sidebar NOT visible  -->  bind index j sidebar-next
bind index j '                                    \
 (or                                             \
   (if (not $sidebar_visible) 'next-undeleted')  \
   ('sidebar-next')                              \
 )                                               \
'

Try something like:

set muttlisp_inline_eval

bind index j (if (equal $sidebar_visible "yes")  \
                 'sidebar-next'                  \
                 'next-undeleted')

The muttlisp can't be inside quotes, so I removed the outer single
quotes.

Also, boolean variables evaluate to "yes" or "no".  I will add this to
the documentation.

Hope that helps.

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to