-
Notifications
You must be signed in to change notification settings - Fork 63
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
fixes #200 #201
base: master
Are you sure you want to change the base?
fixes #200 #201
Conversation
Could you only remove it for mu4e? It works just fine for gnus. |
fixes jeremy-compostella#200 remove undo from message-sent-hook as it was causing an error and for html drafts to be sent after successful message sending (unintended behavior). Also discussed in jeremy-compostella#182 where the hook was suspected to be causing problems jeremy-compostella#182 Note, in jeremy-compostella#182 multiple users report no issues after removing hook. As requested, only turn remove hook from mu4e
updated with requested change, reverted my master branch to keep git history clean. |
Hey @jsilve24 , I am using your repo with my doom config now. It works as it does not complain about "undo outside of visible portion" or so. But drafts are still saved (in html format I think) and not deleted after a successful send. Do you see the same behaviour? |
Yes unfortunately I can confirm it does not fix the whole problem but just part
Sent From My Mobile Device
…________________________________
From: Oliver Reiter ***@***.***>
Sent: Monday, December 9, 2024 4:21:40 AM
To: jeremy-compostella/org-msg ***@***.***>
Cc: Justin Silverman ***@***.***>; Mention ***@***.***>
Subject: Re: [jeremy-compostella/org-msg] fixes #200 (PR #201)
Hey @jsilve24<https://github.com/jsilve24> ,
I am using your repo with my doom config now. It works as it does not complain about "undo outside of visible portion" or so. But drafts are still saved (in html format I think) and not deleted after a successful send. Do you see the same behaviour?
—
Reply to this email directly, view it on GitHub<#201 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AADOORQDHKKP7PSROPL7UG32EVOKJAVCNFSM6AAAAABTA3LREKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRXGM3DKOJZGU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Could this commit in |
Good find. It could be. I just tried out the following function and it does seem to have avoided the "wrote draft" message. Will use this in my config for a day or two to see if any issues pop up. Not sure what the best fix would be. Probably a bug report to mu4e... Whats interesting is that the undesired behavior is only happening with org-msg. Without org-msg loaded its not a problem. Not sure why though... |
What do you mean with "the following function"? The mu4e--compose-before-send function without the change in the commit? |
Oops, my bad. This:
Same function you highlighted. I just commented out hte save-buffer command. I have it added to my config after mu4e loads and it seems to be fixing the problem. No side-effects noted yet. Obviously this is not a great solution but more of a test. |
I have another find: The function |
I've taken a look at this, and have some observations. First, the output in the Messages buffer is pretty different depending on whether mu4e--compose-before-send is allowed to save a draft or not. With (save-buffer):
Without (save-buffer) in mu4e--compose-before-send :
We see three differences.
Altogether, this suggests that saving the buffer causes something to break during message-send, which somehow interrupts parts of the sending process. Debugging with edebug suggests that the warning is getting emitted during erase-buffer in message-do-fcc during message-send. Setting (setq inhibit-read-only t) before sending prevents the HTMLized draft from being shown, reinforcing the idea that this has something to do with read-only text. Poking at the draft buffer, (erase-buffer) doesn't work. Also, the string "--text follows this line--" can't be edited. Starting a fresh org-msg compose buffer, saving it, and then running (erase-buffer) also results in an error. After saving "--text follows this line--" is read only. Opening a regular mu4e compose window and saving does not make "--text follows this line--" read only. This suggests that mu4e's before and after save hooks are causing some kind of problem. Looking at mu4e's save hooks, mu4e--delimit-headers seems like a worthy candidate for further investigation: it removes "--text follows this line--" prior to saving and restores it after. The text which is restored after saving comes from "mu4e--header-separator", which is defined (on my system) as:
Which is... interesting. So, not only does mu4e set it as read-only, but they believe that for some reason the property isn't taking affect. But org-msg somehow... works around mu4e's text property bug, causing an issue deeper down in message.el? Anyway, this suggests an easy test: First, we create an org-msg compose buffer, run mu4e--delimit-headers, then test if "--text follows this line--" is read only. And, yes, it is! Creating a regular mu4e compose buffer, and running mu4e--delimit-headers... does not create read only text. So, something about org-msg fixes a bug in mu4e, exposing read-only buffer text to untested logic down in message-send. Perhaps it's something about the major modes? In org-mode, it's possible to run (insert mu4e--header-separator) and get read-only text but in mu4e's native compose buffer it's not. Maybe message-mode has some logic to prevent read only text? Checking the mode's definition:
There is a hook that strips forbidden properties! Adding the hook to org-msg-edit-mode, plus the patch in this PR makes mu4e send the message, and then hide the buffer without showing me the HTMLized unsaved buffer. I'll push that change up as a PR on top of this branch. |
remove undo from message-sent-hook as it was causing an error and for html drafts to be sent after successful message sending (unintended behavior).
Also discussed in #182 where the hook was suspected to be causing problems #182
Note, in #182 multiple users report no issues after removing hook.