jeremy-compostella / org-msg

OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
GNU General Public License v3.0
275 stars 58 forks source link

org-msg-save-article-for-reply-mu4e not working in mu4e 1.4.3 #46

Closed jsravn closed 3 years ago

jsravn commented 4 years ago

The temp file this function saves seems broken - it breaks when Emacs tries to open it with complaints about characters it couldn't encode. I put details here: https://github.com/jeremy-compostella/org-msg/issues/37#issuecomment-626167095.

Experimenting with it, removing https://github.com/jeremy-compostella/org-msg/blob/2d0540cbd659e6aaf1899f1e0b51f3850c83d5a6/org-msg.el#L356 seems to fix it and I can reply to html emails without a problem.

There seems to be a built in function in mu4e to do this already which org-msg should probably use instead: https://github.com/djcb/mu/blob/05dc6333c38905ce2d1411f06004f7c050532afe/mu4e/mu4e-actions.el#L98

jeremy-compostella commented 4 years ago

I don't use mu4e (I use gnus). I suggest that you experiment with the mu4e existing function and tell me if it works better. If it does, please submit a patch I would be more than happy to review and merge it.

On Sat, May 9, 2020, 8:50 AM James Ravn notifications@github.com wrote:

The temp file this function saves seems broken - it breaks when Emacs tries to open it with complaints about characters it couldn't encode.

Experimenting with it, removing https://github.com/jeremy-compostella/org-msg/blob/2d0540cbd659e6aaf1899f1e0b51f3850c83d5a6/org-msg.el#L356 seems to fix it and I can reply to emails without a problem.

There seems to be a built in function in mu4e to do this already which org-msg should probably use instead: https://github.com/djcb/mu/blob/05dc6333c38905ce2d1411f06004f7c050532afe/mu4e/mu4e-actions.el#L98

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jeremy-compostella/org-msg/issues/46, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMACBGZOJJTNPSADPC7N7TRQV3WBANCNFSM4M43EOEA .

jeremy-compostella commented 4 years ago

Have you got a chance to give a try to mu4e~write-body-to-html ?

jsravn commented 4 years ago

@jeremy-compostella I tried, however it breaks in org-msg-improve-reply-header and org-msg-html-buffer-to-xml that parses the html. I'm guessing these functions will need to be adjusted.

jeremy-compostella commented 4 years ago

Could you share with me an example HTML file that fails in org-msg-improve-reply-header and org-msg-html-buffer-to-xml ?

jsravn commented 4 years ago

Could you share with me an example HTML file that fails in org-msg-improve-reply-header and org-msg-html-buffer-to-xml ?

Here's the error

Debugger entered--Lisp error: (wrong-type-argument consp nil)
  org-msg-improve-reply-header((html nil (head nil (meta ((charset . "UTF-8")))) (body nil (p nil (strong nil "From") ": GitHub <noreply@github.com>" (strong nil "To") ": jsravn-test <james+test@r-vn.org>" (strong nil "Date") ": Thu 07 May 2020 11:54:22 BST" (strong nil "Subject") ": [GitHub] Welcome to GitHub, @jsravn-...") "\15\n\15\n  \15\n    " (meta ((http-equiv . "content-type") (content . "text/html; charset=utf-8"))) (title nil "Welcome to GitHub!") (style ((type . "text/css")) "\15\n\11\11#outlook a{\15\n\11\11\11padding:0;\15\n\11\11}\15\n\11...") (table ((class . "body") (style . "border-spacing:0;border-collapse:colla...")) (tr (...) (td ... "\15\n          " ... "\15\n        ") "\15\n      ")) (comment nil "/.body"))) ((del nil ((font-family . "\"Arial\"") (font-size . "10pt") (color . "grey") (border-left . "none") (text-decoration . "line-through") (margin-bottom . "0px") (margin-top . "10px") (line-height . "11pt"))) (a nil ((color . "#0071c5"))) (a reply-header ((color . "black") (text-decoration . "none"))) (div reply-header ((padding . "3.0pt 0in 0in 0in") (border-top . "solid #e1e1e1 1.0pt") (margin-bottom . "20px"))) (span underline ((text-decoration . "underline"))) (li nil ((font-family . "\"Arial\"") (font-size . "10pt") (line-height . "10pt") (margin-bottom . "0px") (margin-top . "2px"))) (nil org-ul ((list-style-type . "square"))) (nil org-ol ((font-family . "\"Arial\"") (font-size . "10pt") (line-height . "10pt") (margin-bottom . "0px") (margin-top . "0px") (margin-left . "30px") (padding-top . "0px") (padding-left . "5px"))) (nil signature ((font-family . "\"Arial\"") (font-size . "10pt") (margin-bottom . "20px"))) (blockquote nil ((padding-left . "5px") (margin-left . "10px") (margin-top . "20px") (margin-bottom . "0") (border-left . "3px solid #ccc") (font-style . "italic") (background . "#f9f9f9"))) (code nil ((font-size . "10pt") (font-family . "monospace") (background . "#f9f9f9"))) (code src\ src-asl ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-c ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-c++ ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-conf ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-cpp ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-csv ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-diff ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-ditaa ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-emacs-lisp ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-fundamental ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-ini ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-json ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-makefile ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-man ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-org ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-plantuml ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-python ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-sh ((color . "#bbc2cf") (background-color . "#21242b"))) (code src\ src-xml ((color . "#bbc2cf") (background-color . "#21242b"))) (nil linenr ((padding-right . "1em") (color . "black") (background-color . "#aaaaaa"))) (pre nil ((line-height . "12pt") (color . "#bbc2cf") (background-color . "#21242b") (margin . "0px") (font-size . "9pt") (font-family . "monospace"))) (div org-src-container ((margin-top . "10px"))) (nil figure-number ((font-family . "\"Arial\"") (font-size . "10pt") (color . "#0071c5") (font-weight . "bold") (text-align . "left"))) (nil table-number) (caption nil ((text-align . "left") (background . "#0071c5") (color . "white") (font-weight . "bold"))) (nil t-above ((caption-side . "top"))) (nil t-bottom ((caption-side . "bottom"))) ...))
  org-msg-build()
  org-msg-prepare-to-send()
  run-hooks(message-send-hook)
  message-send(nil)
  message-send-and-exit()
  org-msg-ctrl-c-ctrl-c()
  run-hook-with-args-until-success(org-msg-ctrl-c-ctrl-c)
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)

And example HTML written with mu4e~write-body-to-html: https://gist.github.com/jsravn/b4c07878de8cc85a1172bbae052e1121.

The built in mu4e function is actually working pretty well apart from this I think. We should probably just skip the improve reply header for mu4e - the mu4e one looks pretty good already.

jsravn commented 4 years ago

Hmm, maybe not - disabling org-msg-improve-reply-header produces (with my reply here at the top):

image

jeremy-compostella commented 4 years ago

Hmm it looks like I closed by mistake as I still have this item in my TODO list => re-opening.

jeremy-compostella commented 4 years ago

The first problem is that the mu4e~write-body-to-html creates an invalid HTML file with data preceding the root html tag. So I would suggest to make this function create a valid HTML file first.

<head><meta charset="UTF-8"></head>
<p><strong>From</strong>: GitHub &lt;noreply@github.com&gt;</br><strong>To</strong>: jsravn-test &lt;james+test@r-vn.org&gt;</br><strong>Date</strong>: Thu 07 May 2020 11:54:22 BST</br><strong>Subject</strong>: [GitHub] Welcome to GitHub, @jsravn-test!</p><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">

Once this is done, then the fix would be to look for what has been added and put it a div section.

Regards, Jeremy