[neomutt-users] Updating sidebar timing

Pierre-Elliott Bécue becue at crans.org
Mon Jul 24 10:45:57 CEST 2017


Le dimanche 11 juin 2017 à 08:59:46+0200, tuxic at posteo.de a écrit :
> Hi,
> 
> THIS IS NO ERROR REPORT OR CRITISM!
> 
> This is simply curiosity driven... :)
> 
> On a GENTOO Linux box I am running fetchmail via fcron.
> Fetchmail call procmail in turn to put the mail into
> the folders (maildir).
> 
> I am using neomutt with sidebar, which displays my
> mailinglists, to which I am subscribed to and my
> folder for private email.
> 
> As long as there is no new or unread mail, the according
> folder is not displayed.
> 
> If maila arrives, the folder is displayed again -- but without
> the count of new mails.
> Somehow later the count is added.
> 
> Are there two different passes of updates made by neomutt?
> What is the reason for that?
> 
> Thanks a lot inadvance for any info on that! :)

The function that updates the entries visibility is
`void update_entries_visibility(void)`. It is called only once, in
`bool prepare_sidebar(int page_size)`, that prepares all entries to be
displayed in the sidebar.

This function is called only once, in `void mutt_sb_draw(void)`, which is
the main function for drawing the sidebar. It decides wether it should or
not draw depending on the boolean value returner by prepare_sidebar.

The actual drawing is done by a
`void draw_sidebar(int num_rows, int num_cols, int div_width)` called in
mutt_sb_draw only once.

The formatting for the number of messages in the mailbox is done by
`char *cb_format_str(char *dest, size_t destlen, size_t col, int cols,
                                 char op, const char *src, const char *prefix,
                                 const char *ifstring, const char *elsestring,
                                 unsigned long data, format_flag flags)`
which is called by `void make_sidebar_entry(char *buf, unsigned int buflen, int width,
                               char *box, struct SbEntry *sbe)`
itself called by draw_sidebar for each entry.

At this point, I tend to think that everything is done in a same pass. So I
guess the reason you don't see the unread count immediately is that it's
still 0. A sidebar entry relies on another object that has two attributes,
msg_unread and new. New means there's new mail, and msg_unread keeps track
of the count.

I guess what could happen (but I lack time to check my theory) is that the
new variable is set to true, then an update of the sidebar occurs, then only
msg_unread is updated.

Does this issue occur with IMAP of local folder?

-- 
PEB


More information about the neomutt-users mailing list