Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conditional format strings broken in 2024-04-25 #4286

Open
emtiu opened this issue May 4, 2024 · 8 comments
Open

conditional format strings broken in 2024-04-25 #4286

emtiu opened this issue May 4, 2024 · 8 comments
Labels

Comments

@emtiu
Copy link

emtiu commented May 4, 2024

The situation

I've been using a set of highly complex conditional format strings since 2017. After setting them up, I never touched them again, so I've completely forgotten how to read them and how they work (sorry).

These are the format strings in question:

set index_format=" %<[y?%<[w?%<[d?%10[%H:%M]&%10[!%a %H:%M]>&%10[%d.%m. %Hh]>&%-10[%d.%m.%Y]> %18.18F %S %?M?◢ ?%s%* %?X? <%X>?%?M? [%M]?"
set sidebar_format="%B%*  %<n?\<%N\\>&%<N?[%N]&>>"

Changes in 2024-04-16

When updating to 2024-04-16, there was just one minor hitch with sidebar_format when showing a folder with 1 new message:

  • Until 2024-03-29, the sidebar displayed <1>.
  • In 2024-04-16, it displayed <1\> instead.

To fix this, i removed the double backslash from sidebar_format, meaning that I changed

set sidebar_format="%B%*  %<n?\<%N\\>&%<N?[%N]&>>"

into

set sidebar_format="%B%*  %<n?\<%N\>&%<N?[%N]&>>"

which fixed the issue.

Changes in 2024-04-25

When launching 2024-04-25 with the format strings quoted above, I see the following error message:

/[…]/neomuttrc:114: Option index_format: Conditional expando is missing '&' or '?'
source: errors in /[…]/neomuttrc

(Line 114 in neomuttrc contains the index_format quoted above.)

After hitting a key, neomutt starts, but the format strings are all broken, both in the sidebar and in the index.

In the sidebar:

  • all folders with no unread/new messages show &> after the name (before, there would be nothing there)
  • folders with 1 unread message show &[1]> (before, it would display [1])
  • folders with 1 new message show <1&[1]> (before, it would display <1>, see above)

In the index, I don't even recognize the format anymore – maybe it reverts to the default?

Here's an example line from the index with 2024-04-25:
3 r + Apr 25 [email protected] (395K) The Message Subject

Here's the same line with 2024-04-16 (displayed correctly):
25.04. 21h [email protected] r ◢ The Message Subject [2]

What's happening?

As explained above, I have no idea (sorry).

Looking through the recent Issues in this repo, I might be experiencing #4259, #4278, or both.

Maybe there's some other useful thing for you to find here.

@emtiu emtiu added the type:bug Bug label May 4, 2024
@ragu-manjegowda
Copy link

I am running into same issue, refraining from upgrading for now.

This is what I have and it works fine with NeoMutt 20240329

folder-hook Inbox 'set index_format=" %4C %zc %zs %zt  | %-35.35L   %@attachment_info@  %?M10?~(%1M) ?%-30.50s %> %?Y?%Y ? %(!%a %d %h %H:%M)"'

index-format-hook attachment_info '~M text/calendar ~X > 0' ' '
index-format-hook attachment_info '~M text/calendar' "  "
index-format-hook attachment_info '~X > 0' "  "
index-format-hook attachment_info '~A' "   "

set attach_format = "%u%D  %T%-75.75d %<T?&   > %5s · %m/%M"

Similar to op, I have this since 3 years and no idea how they work.

@flatcap
Copy link
Member

flatcap commented May 6, 2024

@emtiu
Sorry about that.
Thanks for the detailed bug report.
I'm working on it and I'll make a release as I can.

@emtiu
Copy link
Author

emtiu commented May 6, 2024

Sure, don't worry and take your time, these things happen :) Let me know if I can help further.

@flatcap
Copy link
Member

flatcap commented May 6, 2024

@ragu-manjegowda
Hmm... I'm surprised that ever worked :-)

There's a 10 (one zero) in the middle of your set index_format... that shouldn't be there.
If I remove that, it works correctly in 2024-04-25, 2024-04-16 and 2024-03-29
(I've also upgrade the %M and %Y conditions to use the modern %<X?Y&Z> format.

folder-hook Inbox 'set index_format=" %4C %zc %zs %zt  | %-35.35L   %@attachment_info@  %<M?~(%1M) >%-30.50s %> %<Y?%Y > %(!%a %d %h %H:%M)"'

index-format-hook attachment_info '~M text/calendar ~X > 0' ' '
index-format-hook attachment_info '~M text/calendar' "  "
index-format-hook attachment_info '~X > 0' "  "
index-format-hook attachment_info '~A' "   "

set attach_format = "%u%D  %T%-75.75d %<T?&   > %5s · %m/%M"

@ragu-manjegowda
Copy link

@ragu-manjegowda Hmm... I'm surprised that ever worked :-)

There's a 10 (one zero) in the middle of your set index_format... that shouldn't be there. If I remove that, it works correctly in 2024-04-25, 2024-04-16 and 2024-03-29 (I've also upgrade the %M and %Y conditions to use the modern %<X?Y&Z> format.

folder-hook Inbox 'set index_format=" %4C %zc %zs %zt  | %-35.35L   %@attachment_info@  %<M?~(%1M) >%-30.50s %> %<Y?%Y > %(!%a %d %h %H:%M)"'

index-format-hook attachment_info '~M text/calendar ~X > 0' ' '
index-format-hook attachment_info '~M text/calendar' "  "
index-format-hook attachment_info '~X > 0' "  "
index-format-hook attachment_info '~A' "   "

set attach_format = "%u%D  %T%-75.75d %<T?&   > %5s · %m/%M"

Thank you so much :) You are the best!

@Tonus1
Copy link

Tonus1 commented May 13, 2024

Just hitted something similar.

This worked since several years and broke in last 2024-04-25 version :

set index_format="%4C|%=11y| %<[y?%<[m?%<[d?%-10.10[%H:%M]&%-10.10[%d %a]>&%-10.10[%d %b]>&%-10.10[%b %Y]> | %-25.25L|%?X?A&-?| %Z |%?M?#%-2.2M >>>&? %s%> |%=8c"

The >>> seems to be the culprit as changed with ··· like this worked :

set index_format="%4C|%=11y| %<[y?%<[m?%<[d?%-10.10[%H:%M]&%-10.10[%d %a]>&%-10.10[%d %b]>&%-10.10[%b %Y]> | %-25.25L|%?X?A&-?| %Z |%?M?#%-2.2M ···&? %s%>  |%=8c"

If that can help...

@flatcap
Copy link
Member

flatcap commented May 13, 2024

@Tonus1
Yes, that's the same problem.
The parser is working on a conditional %<X?... then finds some plain text > that looks like its end marker.

@anufrievroman
Copy link

I have the same error message but for this line:

set status_format = " %f • %l • %m messages%?n? • %n new ?%?d? • %d to delete ?%?t?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants