[mu4e bug] mu4e-compose-context-switch does not change draft folder (MessageID is not saved)
Describe the bug
[Label should be mu4e bug not mu. Sorry].
In the development version, mu4e-compose-context-switch is broken in the sense that the draft message is not moved to the draft folder of the new context.
I think the reason is that the message ID is no longer saved in the draft as a message field. mu4e-compose-context-switch relies on this field to get the message ID and move the message to the new draft folder.
There doesn't seem to be a way to obtain the message ID of a currently opened draft (unless it is being edited and mu4e-compose-parent-message has that info).
The reason Message-ID is not saved seems to be in mu4e~compose-before-save-hook-fn where the command
(message-generate-headers '(Message-ID))
adds the Message-ID header but then
(message-generate-headers '(Date))
adds the date and removes the Message-ID
Note that message-deletable-headers default value is (Message-ID Date Lines) so Message-ID will be deleted when Data is added.
To Reproduce Compose a new message, save it and switch context. The context is switched but the message remains in the draft folder of the old context.
Environment mu: 1.7.0 Emacs: 27.2
Checklist
- [x] you are running either the latest 1.6.x release, or a 1.7.x development release (otherwise, please upgrade).
TBH, I'm not too fond of that part of the context-switch, it's just too fragile (as seen here), and there are some possibilities for user data-loss; I guess we should just remove that part.
@djcb, agreed. Perhaps it is better left to the use.
However, my comment about MessageID not being saved in some cases is not mu4e-compose-context-switch specific. Not sure if other utilities (including user ones) use this header field to get the messageID of the draft.
This functionality doesn't quite work with the new message composer, and I've removed it for now... on the other hand, the message-id is handled correctly now. Anyway, closing this. Thank you!