emacs-helm / helm-mu

Helm sources for searching emails and contacts using mu
GNU General Public License v3.0
58 stars 9 forks source link

Preserve the search pattern #42

Closed Ambrevar closed 7 years ago

Ambrevar commented 7 years ago

Could be related to #5 and #6.

When I do a helm-mu search foo which displays several messages, I press RET on one e-mail. Then I can see that the e-mail is the only one in the headers view: indeed, the search pattern is now msgid:... and not foo anymore.

Is there a good reason for this? I think it's more convenient to preserve the search pattern: it allows the user to keep browsing the results without having to redo the search. The pattern can also be augmented as opposed to the msgid:... pattern.

tmalsburg commented 7 years ago

Yes, this behavior is somewhat annoying. However, it is necessary to work around a bug in mu4e. If we only open the message, it is not possible to retrieve its attachments. The attachments are only accessible when the message is displayed in header view. If there is a better workaround, I'd be happy to add it.

Ambrevar commented 7 years ago

What do you mean "the message is displayed in header view"? When we quit mu4e-view, mu4e goes back to the headers view. Whether the search pattern was msgid... or the user pattern, the message would be displayed anyways. I'm missing your point I suppose.

Was the bug reported upstream?

tmalsburg commented 7 years ago

Ok, I misremembered this. I thought we had added a workaround in helm-mu but in fact we added it in mu4e. See the function mu4e-view-message-with-message-id (which, by the way, is marked obsolete). I guess it's better to open an issue with mu/mu4e then.

Sidenote: org-mu4e.el also uses this function to open messages through links, at least it did last time I checked. So this problem does not just occur with helm-mu. With org, the headers buffer is needlessly changes when we open a message link.

Ambrevar commented 7 years ago

It's mu4e-view-message-with-msgid that is obsolete, not mu4e-view-message-with-message-id.

It still fail to see where the issue lies. Why not calling mu4e-headers-view-message after the search?

tmalsburg commented 7 years ago

Not sure whether this works. When you call this from helm-mu, there may not be a headers view. Note that what you see in helm-mu and mu4e's headers view are not the same thing although they look similar. Could you try your approach and make a PR if it works?

Ambrevar commented 7 years ago

You can spawn a headers view anytime with a search pattern:

(mu4e-headers-search PATTERN)

I'll give it a try and report later.

Ambrevar commented 7 years ago

Took 2 months to come up with the shortest PR ever! :)