mu
mu copied to clipboard
[mu4e rfe] Don't run mu4e-update-mail-and-index while reading Unread Messages
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I'm always frustrated when reading a thread (perhaps a mailinglist thread) through the Unread messages, then the mu4e auto-update comes in and refreshes the entire Unread buffer. then let's say I want to view the next/previous email in the thread, but using n
or p
cannot find it anymore, realizing that the entire thread disappeared or reorganized! Because as I opened the email, it is marked as read, and the Unread buffer is updated and the current thread I'm reading is completely gone!
Describe the solution you'd like A clear and concise description of what you want to happen.
The easiest solution could be to implement a flag (something like mu4e-pause-auto-update-while-unread
) for this specific case, if the flag is non-nil, check if the mu4e-headers
is in the (window-list)
and check if it contains the unread
flag, if so don't run mu4e-update-mail-and-index
in the background, skip until the next cycle of mu4e-update-interval
.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
You can set mu4e-headers-auto-update
to nil
for exactly the reason you've described. I don't see a reason for a new option here, and especially it sounds very awkward to inhibit updates depending on the headers buffer being shown in a window or not.
Yes, but that will set it globally. I can only see a workaround using setq-local
and checking the conditions I described above.
Since you can have just one headers buffer anyway, I don't see how the distinction between global and local in that buffer makes any difference.
You also suggested to skip the update if the current headers view contains at least one message with an unread
flag. Don't you mean, it contains some message which has the read
mark attached so that applying marks will make it read and a new search for unread mail won't find it anymore?
I could somehow understand that although I would generalize it to "don't auto-update if the headers view has any marks on some messages". That could indeed be another value next to t
and nil
for mu4e-headers-auto-update
.
Since you can have just one headers buffer anyway, I don't see how the distinction between global and local in that buffer makes any difference.
I still like to auto-update when I'm not reading emails from the unread list though, which will require the auto-update flag to be turned on, that's why I can only think of using setq-local
to set it to nil
when reading an email.
You also suggested to skip the update if the current headers view contains at least one message with an
unread
flag. Don't you mean, it contains some message which has theread
mark attached so that applying marks will make it read and a new search for unread mail won't find it anymore?I could somehow understand that although I would generalize it to "don't auto-update if the headers view has any marks on some messages". That could indeed be another value next to
t
andnil
formu4e-headers-auto-update
.
I actually mean it from the modeline, it displays flag:unread AND NOT flag:t ...
, I don't know mu4e enough to understand where exactly are these flags been changed/set/etc.
Basically, I don't want mu4e to auto-update only when I'm reading an email(s) from the unread list that's opened using b u
(M-x mu4e-headers-search-bookmark u
), but still want it to auto-update in all other cases, what's the best way to do that?
You might want to try adding a function to mu4e-headers-search-hook
or mu4e-headers-search-bookmark-hook
which checks if the query contains flag:unread
and if so, sets mu4e-headers-auto-update
to nil
buffer-locally.
But I'm not sure if that buffer-local value will be picked up. I also don't know if mu4e creates a new headers buffer for every search or reuses just one buffer. In the latter case, that buffer local setting would stick forever in which case you could adapt your function to also set mu4e-headers-auto-update
to t
if the search does not contain flag:unread
.
So the following function added to mu4e-headers-search-hook
or mu4e-headers-search-bookmark-hook
might do:
(lambda (query)
(setq-local mu4e-headers-auto-update
(string-match-p "flag:unread" query)))
Note that mu4e-headers-search-hook
is executed also before normal manual searches but before mu4e-query-rewrite-function
. mu4e-headers-search-bookmark-hook
runs just for bookmark searches and I have no clue if before or after mu4e-query-rewrite-function
...
I'm going to change it to not update when looking at a message; basically same issue as in #1055.