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

org-msg leads to saving html draft after sending #200

Open
jsilve24 opened this issue Nov 11, 2024 · 5 comments
Open

org-msg leads to saving html draft after sending #200

jsilve24 opened this issue Nov 11, 2024 · 5 comments

Comments

@jsilve24
Copy link

In the past few weeks I have started noticing a new bug that goes away when I disable org-msg and only reappears when org-msg is loaded.

After I send a message the html version is being saved as a draft. Here is the output in the messages buffer.

250 Queued mail for delivery
Sending email done
221 Closing connection
Saving file /home/jds6696/.mail/psu/Drafts/cur/1731348827.b034f8b18db8eb68.lenovogen2sil:2,DS...
Wrote /home/jds6696/.mail/psu/Drafts/cur/1731348827.b034f8b18db8eb68.lenovogen2sil:2,DS
primitive-undo: Changes to be undone are outside visible portion of buffer

I also don't understand what the primitive-undo is that also seems to be tied to having org-msg loaded.

I am using the most recent version of org-msg and mu4e.

Sorry this isn't more helpful of a bug report but after trying to track this down for the past hour I am somewhat at a loss. Any help would be most appreicated.

@djs42012
Copy link

Hello, I am encountering the same error.

Description

When sending emails using mu4e with org-msg is enabled, the message sends but the compose window stays open and a draft is left in my mailbox. The error doesn't occur when org-msg is disabled. Specifically, it states:

Error "Changes to be undone are outside visible portion of buffer"

Steps to Reproduce:

  1. Enable mu4e and org-msg integration in Doom Emacs.
  2. Compose and send an email.

Expected Behavior:

The email should be sent without any errors, and the compose buffer should be killed and the window closed.

Actual Behavior:

An error is thrown, preventing the the window from closing. Additionally, a draft is left over, despite the message having sent successfully.

System Information:

  • Emacs Version: 29.4
  • muVersion: 1.12.7
  • org-msg version: commit 59e2042
  • DOOM version: latest

Debug Log:

Debugger entered--Lisp error: (error "Changes to be undone are outside visible portion o...")
  error("Changes to be undone are outside visible portion o...")
  primitive-undo(1 ((116 . 117) (nil face nil 251 . 253) (nil message-deletable nil 251 . 253) (nil face nil 241 . 251) (nil message-deletable nil 241 . 251) (241 . 277) (nil face nil 207 . 209) (nil message-deletable nil 207 . 209) (nil face nil 203 . 207) (nil message-deletable nil 203 . 207) (203 . 241) (#("Date: Mon, 18 Nov 2024 20:55:21 -0500\n" 0 5 (face message-header-name message-deletable t wrap-prefix "        " line-prefix "" fontified t) 5 6 (message-deletable t wrap-prefix "        " line-prefix "" fontified t) 6 37 (face message-header-other wrap-prefix "        " line-prefix "" fontified t) 37 38 (wrap-prefix "        " line-prefix "" fontified t)) . 203) (nil mml nil 1257 . 1259) (nil mml nil 1248 . 1257) (nil mml nil 1245 . 1248) (nil mml nil 1243 . 1245) (nil mml nil 1234 . 1243) (nil mml nil 1231 . 1234) (nil mml nil 1229 . 1231) (nil mml nil 1224 . 1229) (nil mml nil 1222 . 1224) (nil mml nil 1208 . 1222) (nil mml nil 1201 . 1208) (nil mml nil 1196 . 1201) (nil mml nil 1189 . 1196) (nil mml nil 1075 . 1189) (nil mml nil 722 . 1075) (nil mml nil 427 . 722) (nil mml nil 425 . 427) (nil mml nil 406 . 425) (nil mml nil 389 . 406) (nil mml nil 385 . 389) (nil mml nil 383 . 385) (nil mml nil 381 . 383) (nil mml nil 376 . 381) (nil mml nil 374 . 376) (nil mml nil 367 . 374) (nil mml nil 365 . 367) (nil mml nil 346 . 365) (nil mml nil 328 . 346) (nil mml nil 324 . 328) (nil mml nil 322 . 324) (nil mml nil 320 . 322) (nil mml nil 303 . 320) (nil mml nil 294 . 303) (nil mml nil 292 . 294) (nil mml nil 290 . 292) (nil mml nil 279 . 290) (nil mml nil 270 . 279) (nil mml nil 268 . 270) ...))
  undo-more(1)
  undo()
  funcall(undo)
  (condition-case e (funcall hook) ((debug error) (signal 'doom-hook-error (list hook e))))
  doom-run-hook(undo)
  run-hook-wrapped(doom-run-hook undo)
  (let ((doom--hook hook)) (run-hook-wrapped hook #'doom-run-hook))
  (condition-case e (let ((doom--hook hook)) (run-hook-wrapped hook #'doom-run-hook)) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error "Error running hook %S because: %s" (if (symbolp (car (cdr e))) (symbol-name (car (cdr e))) (car (cdr e))) (car (cdr (cdr e))))) (signal 'doom-hook-error (cons hook (cdr e)))))
  ...

This report can be used to open an issue with either the org-msg or mu4e repositories on GitHub.

@zauster
Copy link

zauster commented Nov 21, 2024

+1, also using Doom Emacs. But jsilve24 does not seem to use Doom, so I guess it might be a org-msg issue

@jsilve24
Copy link
Author

jsilve24 commented Dec 3, 2024

I actually have some of my config stolen from Doom so its possible thats the issue. Trying to track it down.

@aatmunbaxi
Copy link

I'm encountering a similar issue related to saving drafts.

It seems to be an issue with org-msg itself; I can reproduce the issue I'm having with just org-msg (i.e. without doom's +org flag and its related configuration) and doom's mu4e,.

I do not run into the issue without org-msg-mode enabled.

jsilve24 added a commit to jsilve24/org-msg that referenced this issue Dec 4, 2024
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
jsilve24 added a commit to jsilve24/org-msg that referenced this issue Dec 4, 2024
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
@jsilve24
Copy link
Author

jsilve24 commented Dec 4, 2024

Behavior seems to be originating from adding undo to the message-sent-hook. Removing fixes the issue. Here is the patch, I also submitted a pull request.

---
 org-msg.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/org-msg.el b/org-msg.el
index 558590c..2160507 100644
--- a/org-msg.el
+++ b/org-msg.el
@@ -1553,7 +1553,6 @@ Type \\[org-msg-attach] to call the dispatcher for attachment
 \\{org-msg-edit-mode-map}"
   (setq-local message-sent-message-via nil)
   (add-hook 'message-send-hook 'org-msg-prepare-to-send nil t)
-  (add-hook 'message-sent-hook 'undo t t)
   (add-hook 'completion-at-point-functions 'message-completion-function nil t)
   (cond ((message-mail-alias-type-p 'abbrev) (mail-abbrevs-setup))
 	((message-mail-alias-type-p 'ecomplete) (ecomplete-setup)))
-- 

jsilve24 added a commit to jsilve24/.emacs.d that referenced this issue Dec 4, 2024
jsilve24 added a commit to jsilve24/org-msg that referenced this issue Dec 6, 2024
jsilve24 added a commit to jsilve24/org-msg that referenced this issue Dec 6, 2024
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
@jsilve24 jsilve24 mentioned this issue Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants