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

[mu4e rfe]Consistent Ordering of Mail Messages with Identical Dates After Deletion #2527

Closed
tshu-w opened this issue Jul 30, 2023 · 6 comments
Labels
mu4e specific for mu4e rfe

Comments

@tshu-w
Copy link

tshu-w commented Jul 30, 2023

Is your feature request related to a problem? Please describe.
Yes, my feature request relates to a problem I frequently encounter. Specifically, I'm always frustrated when the order of my mail messages with the same date becomes inconsistent whenever I delete some of these messages.

Here is an illustration:

Screenshot 2023-07-30 at 09 31 09 Screenshot 2023-07-30 at 09 31 37

If I delete the email on the fifth line, the order of the subsequent emails will be messed up.

Describe the solution you'd like
Sort according to mu4e-search-sort-field, and then by message id.

@tshu-w tshu-w added mu4e specific for mu4e new rfe labels Jul 30, 2023
@tshu-w
Copy link
Author

tshu-w commented Jul 30, 2023

After digging into the code, I found that mu4e only displays the results returned by mu. This feature request may need to be implemented on the mu side.

mu/mu4e/mu4e-server.el

Lines 543 to 569 in 5409c2c

(defun mu4e--server-find (query threads sortfield sortdir maxnum skip-dups
include-related)
"Run QUERY with THREADS SORTFIELD SORTDIR MAXNUM SKIP-DUPS INCLUDE-RELATED.
If THREADS is non-nil, show results in threaded fashion,
SORTFIELD is a symbol describing the field to sort by (or nil);
see `mu4e~headers-sortfield-choices'. If SORT is `descending',
sort Z->A, if it's `ascending', sort A->Z. MAXNUM determines the
maximum number of results to return, or nil for unlimited. If
SKIP-DUPS is non-nil, show only one of duplicate messages (see
`mu4e-headers-skip-duplicates'). If INCLUDE-RELATED is non-nil,
include messages related to the messages matching the search
query (see `mu4e-headers-include-related').
For each result found, a function is called, depending on the
kind of result. The variables `mu4e-error-func' contain the
function that to be be called for, resp., a message (header)
or an error."
(mu4e--server-call-mu
`(find
:query ,query
:threads ,(and threads t)
:sortfield ,sortfield
:descending ,(if (eq sortdir 'descending) t nil)
:maxnum ,maxnum
:skip-dups ,(and skip-dups t)
:include-related ,(and include-related t))))

@djcb djcb removed the new label Jul 30, 2023
@djcb
Copy link
Owner

djcb commented Jul 30, 2023

Where does the number in the first column come from? I.e., what does your mu4e-header-fields look like? And when does it become "messed up"? Whe you re-query?

And do these message have the exact same date (the exact same seconds, when you look in the viewer)?

@tshu-w
Copy link
Author

tshu-w commented Jul 30, 2023

Where does the number in the first column come from? I.e., what does your mu4e-header-fields look like? And when does it become "messed up"? Whe you re-query?

And do these message have the exact same date (the exact same seconds, when you look in the viewer)?

  1. The number is come from global-display-line-numbers-mode.
  2. My mu4e-header-fields is
((:account . 10)
 (:human-date . 12)
 (:flags . 6)
 (:from . 22)
 (:subject))
  1. When I delete the five line message and M-x mu4e-search-rerun, I got the following messages messed up.
  2. Yes, these messages have the exact same date, all are Sat, 29 Jul 2023 10:30:26 -0700.

@djcb
Copy link
Owner

djcb commented Aug 4, 2023

So do the line numbers get messed up, or did you just do that to illustrate the problem?

IIRC, the underlying problem is that messages are sorted by date, and that the sorting of messages with the same date is not stable. So perhaps we need another criterion as the tie-breaker.

@tshu-w
Copy link
Author

tshu-w commented Aug 4, 2023

So do the line numbers get messed up, or did you just do that to illustrate the problem?

I used relative line numbers, which are unrelated to the issue and can be ignored.

IIRC, the underlying problem is that messages are sorted by date, and that the sorting of messages with the same date is not stable. So perhaps we need another criterion as the tie-breaker.

Yes, I think so. Maybe message id?

@djcb
Copy link
Owner

djcb commented Mar 18, 2024

I promoted this ticket to IDEAS.org, closing there. It seems like quite a few changes for somewhat of a corner-case, so I'm not sure if anyone has time to work on this soon. Thanks!

@djcb djcb closed this as completed Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mu4e specific for mu4e rfe
Projects
None yet
Development

No branches or pull requests

2 participants