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
280 stars 60 forks source link

send fails with `Wrong type argument: listp, part` #39

Closed titaniumbones closed 4 years ago

titaniumbones commented 4 years ago

org-msg-ctrl-c-ctrl-c fails for me in emacs 28.0.50 (pretty recent) on line 4250 of message.el (last line of the section of code below). Not sure what's going on exactly.

    (while (and success
        (setq elem (pop alist)))
      (when (funcall (cadr elem))
    (when (and (or (not (memq (car elem)
                  message-sent-message-via))
               (message-fetch-field "supersedes")
               (if (or (message-gnksa-enable-p 'multiple-copies)
                   (not (eq (car elem) 'news)))
               (y-or-n-p
                (format
                 "Already sent message via %s; resend? "
                 (car elem)))
             (error "Denied posting -- multiple copies")))
           (setq success (funcall (caddr elem) arg)))

The message sends fine if I turn off org-msg-mode and manually run message-send, so I assume it has something to do with the parts that get generated. I can attach the message source if that seems helpful.

thanks for you help as always!

jeremy-compostella commented 4 years ago

Could you enable debug M-x toggle-debug-on-error and capture the backtrace ?

titaniumbones commented 4 years ago

Sorry, should have done that to start with. Here it is:

Debugger entered--Lisp error: (wrong-type-argument listp part)
  mml-compute-boundary-1(part)
  mapc(mml-compute-boundary-1 ((part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n\n\n[testing]\n\n\n[testing] <https:/..." 0 62 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 298) (contents . "<html lang=\"en\"><head><!-- 2020-04-03 Fri 18:44 --...")))
  mml-compute-boundary-1((multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n\n\n[testing]\n\n\n[testing] <https:/..." 0 62 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 298) (contents . "<html lang=\"en\"><head><!-- 2020-04-03 Fri 18:44 --...")))
  mapc(mml-compute-boundary-1 ((multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n\n\n[testing]\n\n\n[testing] <https:/..." 0 62 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 298) (contents . "<html lang=\"en\"><head><!-- 2020-04-03 Fri 18:44 --..."))))
  mml-compute-boundary-1((multipart (type . "mixed") (multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n\n\n[testing]\n\n\n[testing] <https:/..." 0 62 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 298) (contents . "<html lang=\"en\"><head><!-- 2020-04-03 Fri 18:44 --..."))))
  mml-compute-boundary((multipart (type . "mixed") (multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n\n\n[testing]\n\n\n[testing] <https:/..." 0 62 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 298) (contents . "<html lang=\"en\"><head><!-- 2020-04-03 Fri 18:44 --..."))))
  mml-generate-mime-1((multipart (type . "mixed") (multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n\n\n[testing]\n\n\n[testing] <https:/..." 0 62 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 298) (contents . "<html lang=\"en\"><head><!-- 2020-04-03 Fri 18:44 --..."))))
  mml-generate-mime(nil nil)
  message-encode-message-body()
  message-send-mail(nil)
  message-send-via-mail(nil)
  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)
jeremy-compostella commented 4 years ago

This is likely because of the patches I pushed to Emacs to resolve some issues with mml. I have not updated the org-msg module yet. I suppose that you are building emacs from source. If so I suggest that you revert my two patches on mml.el entered recently (in the last three month). Let me know if it resolve this issue.

titaniumbones commented 4 years ago

I actually use the Arch emacs-git packages but I can build from source -- might take me a day or two to get around to it though. thanks for the heads up, I will check out yr commits to mml.el

titaniumbones commented 4 years ago

Couldn't figure out how to build the arch emacs-git packages but, duh, just cloned the emacs git repo and evaluated mml.el at various stages -- the issue is definitely introduced in the 2nd of your two commits, e1e1bd8f85c53fea9f61b6ec99b461ddd93461b9 . should I just keep evaluating the previous version by hand for a bit till this is updated in org-msg?

jeremy-compostella commented 4 years ago

Or you could try the new patch I have pushed on the experimental branch.

titaniumbones commented 4 years ago

hmm, tried it briefly and seems to still give the error. I checked to be sure and (org-mml-recursive-support) yields t, so I think I have done everything I need to.. .but I'm not sure if I might still be doing something wrong.

The message generated by org-msg-prepare-to-send is

--text follows this line--
<#multipart type=alternative>
<#part type="text/plain" disposition=inline>
Matt Price

Hi ,
<#/part>
<#part type="text/html" disposition=inline>
<html lang="en"><head><!-- 2020-04-09 Thu 09:14 --><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="generator" content="Org mode"/><meta name="author" content="Matt Price"/></head><body>
<article id="content"><p style="text-decoration:none;margin-bottom:0px;margin-top:10px;line-height:11pt;font-size:10pt;font-family:&quot;Arial&quot;;max-width:100ch;">
Hi ,
</p>
</article><script>window.klipse_settings = {selector_eval_html: '.src-html',
                             selector_eval_js: '.src-js',
                             selector_eval_python_client: '.src-python',
                             selector_eval_scheme: '.src-scheme',
                             selector: '.src-clojure',
                             selector_eval_ruby: '.src-ruby'};</script><script src="https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"/><link rel="stylesheet" type="text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css"/></body></html><#/part>
<#/multipart>

Here is the debug-on-error output (looks slightly different to above):

Debugger entered--Lisp error: (wrong-type-argument listp part)
  car(part)
  (member (car cont) '(part mml))
  (cond ((member (car cont) '(part mml)) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (mm-enable-multibyte) (let (... ... mml-sign-alist mml-encrypt-alist) (mml-generate-mime-1 cont)) (goto-char (point-min)) (if (re-search-forward ... nil t) (progn ... ...))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) ((eq (car cont) 'multipart) (mapc 'mml-compute-boundary-1 (cdr (cdr cont)))))
  mml-compute-boundary-1(part)
  mapc(mml-compute-boundary-1 ((part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n" 0 18 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 413) (contents . "<html lang=\"en\"><head><!-- 2020-04-09 Thu 09:10 --...")))
  (cond ((member (car cont) '(part mml)) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (mm-enable-multibyte) (let (... ... mml-sign-alist mml-encrypt-alist) (mml-generate-mime-1 cont)) (goto-char (point-min)) (if (re-search-forward ... nil t) (progn ... ...))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) ((eq (car cont) 'multipart) (mapc 'mml-compute-boundary-1 (cdr (cdr cont)))))
  mml-compute-boundary-1((multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n" 0 18 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 413) (contents . "<html lang=\"en\"><head><!-- 2020-04-09 Thu 09:10 --...")))
  mapc(mml-compute-boundary-1 ((multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n" 0 18 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 413) (contents . "<html lang=\"en\"><head><!-- 2020-04-09 Thu 09:10 --..."))))
  (cond ((member (car cont) '(part mml)) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (mm-enable-multibyte) (let (... ... mml-sign-alist mml-encrypt-alist) (mml-generate-mime-1 cont)) (goto-char (point-min)) (if (re-search-forward ... nil t) (progn ... ...))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) ((eq (car cont) 'multipart) (mapc 'mml-compute-boundary-1 (cdr (cdr cont)))))
  mml-compute-boundary-1((multipart (type . "mixed") (multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n" 0 18 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 413) (contents . "<html lang=\"en\"><head><!-- 2020-04-09 Thu 09:10 --..."))))
  mapc(mml-compute-boundary-1 ((tag-location . 311) (part (type . "text/plain") (disposition . "inline") (tag-location . 341) (contents . "Matt Price\n\n\nHi ,\n")) (multipart (type . "mixed") (multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n" 0 18 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 413) (contents . "<html lang=\"en\"><head><!-- 2020-04-09 Thu 09:10 --...")))))
  (cond ((member (car cont) '(part mml)) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (mm-enable-multibyte) (let (... ... mml-sign-alist mml-encrypt-alist) (mml-generate-mime-1 cont)) (goto-char (point-min)) (if (re-search-forward ... nil t) (progn ... ...))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) ((eq (car cont) 'multipart) (mapc 'mml-compute-boundary-1 (cdr (cdr cont)))))
  mml-compute-boundary-1((multipart (type . "alternative") (tag-location . 311) (part (type . "text/plain") (disposition . "inline") (tag-location . 341) (contents . "Matt Price\n\n\nHi ,\n")) (multipart (type . "mixed") (multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n" 0 18 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 413) (contents . "<html lang=\"en\"><head><!-- 2020-04-09 Thu 09:10 --...")))))
  (catch 'not-unique (mml-compute-boundary-1 cont))
  (not (catch 'not-unique (mml-compute-boundary-1 cont)))
  (while (not (catch 'not-unique (mml-compute-boundary-1 cont))))
  (if mml-inhibit-compute-boundary nil (while (not (catch 'not-unique (mml-compute-boundary-1 cont)))))
  (let ((mml-boundary (funcall mml-boundary-function (setq mml-multipart-number (1+ mml-multipart-number))))) (if mml-inhibit-compute-boundary nil (while (not (catch 'not-unique (mml-compute-boundary-1 cont))))) mml-boundary)
  mml-compute-boundary((multipart (type . "alternative") (tag-location . 311) (part (type . "text/plain") (disposition . "inline") (tag-location . 341) (contents . "Matt Price\n\n\nHi ,\n")) (multipart (type . "mixed") (multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n" 0 18 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 413) (contents . "<html lang=\"en\"><head><!-- 2020-04-09 Thu 09:10 --...")))))
  (let ((mml-boundary (mml-compute-boundary cont))) (insert (format "Content-Type: multipart/%s; boundary=\"%s\"" type mml-boundary) (if (cdr (assq 'start cont)) (format "; start=\"%s\"\n" (cdr (assq 'start cont))) "\n")) (let ((cont cont) part) (while (setq part (car-safe (prog1 cont (setq cont (cdr cont))))) (if (and (consp part) (consp (cdr part))) (progn (insert "\n--" mml-boundary "\n") (mml-generate-mime-1 part) (goto-char (point-max)))))) (insert "\n--" mml-boundary "--\n"))
  (if handler (funcall (cdr handler) cont) (let ((mml-boundary (mml-compute-boundary cont))) (insert (format "Content-Type: multipart/%s; boundary=\"%s\"" type mml-boundary) (if (cdr (assq 'start cont)) (format "; start=\"%s\"\n" (cdr (assq 'start cont))) "\n")) (let ((cont cont) part) (while (setq part (car-safe (prog1 cont (setq cont ...)))) (if (and (consp part) (consp (cdr part))) (progn (insert "\n--" mml-boundary "\n") (mml-generate-mime-1 part) (goto-char (point-max)))))) (insert "\n--" mml-boundary "--\n")))
  (let* ((type (or (cdr (assq 'type cont)) "mixed")) (mml-generate-default-type (if (equal type "digest") "message/rfc822" "text/plain")) (handler (assoc type mml-generate-multipart-alist))) (if handler (funcall (cdr handler) cont) (let ((mml-boundary (mml-compute-boundary cont))) (insert (format "Content-Type: multipart/%s; boundary=\"%s\"" type mml-boundary) (if (cdr (assq 'start cont)) (format "; start=\"%s\"\n" (cdr (assq ... cont))) "\n")) (let ((cont cont) part) (while (setq part (car-safe (prog1 cont ...))) (if (and (consp part) (consp ...)) (progn (insert "\n--" mml-boundary "\n") (mml-generate-mime-1 part) (goto-char ...))))) (insert "\n--" mml-boundary "--\n"))))
  (cond ((or (eq (car cont) 'part) (eq (car cont) 'mml)) (let* ((raw (cdr (assq 'raw cont))) (filename (cdr (assq 'filename cont))) (type (or (cdr (assq ... cont)) (if filename (or ... "application/octet-stream") "text/plain"))) (charset (cdr (assq 'charset cont))) (coding (mm-charset-to-coding-system charset)) encoding flowed coded) (cond ((eq coding 'ascii) (setq charset nil coding nil)) (charset (setq charset (or (mm-coding-system-to-mime-charset coding) (intern ...))))) (if (and (not raw) (member (car (split-string type "/")) '("text" "message"))) (progn (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...))) (mml-insert-mime-headers cont type charset encoding flowed) (insert "\n") (insert coded)) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ... ... ... ...) (and ... ...)))) (mml-insert-mime-headers cont type charset encoding nil) (insert "\n" coded)))) ((eq (car cont) 'external) (insert "Content-Type: message/external-body") (let ((parameters (mml-parameter-string cont '(expiration size permission))) (name (cdr (assq 'name cont))) (url (cdr (assq 'url cont)))) (if name (progn (setq name (mml-parse-file-name name)) (if (stringp name) (mml-insert-parameter (mail-header-encode-parameter "name" name) "access-type=local-file") (mml-insert-parameter (mail-header-encode-parameter "name" ...) (mail-header-encode-parameter "site" ...) (mail-header-encode-parameter "directory" ...)) (mml-insert-parameter (concat "access-type=" ...))))) (if url (progn (mml-insert-parameter (mail-header-encode-parameter "url" url) "access-type=url"))) (if parameters (progn (mml-insert-parameter-string cont '(expiration size permission)))) (insert "\n\n") (insert "Content-Type: " (or (cdr (assq 'type cont)) (if name (or (mm-default-file-encoding name) "application/octet-stream") "text/plain")) "\n") (insert "Content-ID: " (message-make-message-id) "\n") (insert "Content-Transfer-Encoding: " (or (cdr (assq 'encoding cont)) "binary")) (insert "\n\n") (insert (or (cdr (assq 'contents cont)))) (insert "\n"))) ((eq (car cont) 'multipart) (let* ((type (or (cdr (assq ... cont)) "mixed")) (mml-generate-default-type (if (equal type "digest") "message/rfc822" "text/plain")) (handler (assoc type mml-generate-multipart-alist))) (if handler (funcall (cdr handler) cont) (let ((mml-boundary (mml-compute-boundary cont))) (insert (format "Content-Type: multipart/%s; boundary=\"%s\"" type mml-boundary) (if (cdr ...) (format "; start=\"%s\"\n" ...) "\n")) (let ((cont cont) part) (while (setq part ...) (if ... ...))) (insert "\n--" mml-boundary "--\n"))))) (t (error "Invalid element: %S" cont)))
  (save-restriction (narrow-to-region (point) (point)) (mml-tweak-part cont) (cond ((or (eq (car cont) 'part) (eq (car cont) 'mml)) (let* ((raw (cdr (assq ... cont))) (filename (cdr (assq ... cont))) (type (or (cdr ...) (if filename ... "text/plain"))) (charset (cdr (assq ... cont))) (coding (mm-charset-to-coding-system charset)) encoding flowed coded) (cond ((eq coding 'ascii) (setq charset nil coding nil)) (charset (setq charset (or ... ...)))) (if (and (not raw) (member (car ...) '...)) (progn (let (...) (save-current-buffer ... ...)) (mml-insert-mime-headers cont type charset encoding flowed) (insert "\n") (insert coded)) (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...))) (mml-insert-mime-headers cont type charset encoding nil) (insert "\n" coded)))) ((eq (car cont) 'external) (insert "Content-Type: message/external-body") (let ((parameters (mml-parameter-string cont '...)) (name (cdr (assq ... cont))) (url (cdr (assq ... cont)))) (if name (progn (setq name (mml-parse-file-name name)) (if (stringp name) (mml-insert-parameter ... "access-type=local-file") (mml-insert-parameter ... ... ...) (mml-insert-parameter ...)))) (if url (progn (mml-insert-parameter (mail-header-encode-parameter "url" url) "access-type=url"))) (if parameters (progn (mml-insert-parameter-string cont '...))) (insert "\n\n") (insert "Content-Type: " (or (cdr (assq ... cont)) (if name (or ... "application/octet-stream") "text/plain")) "\n") (insert "Content-ID: " (message-make-message-id) "\n") (insert "Content-Transfer-Encoding: " (or (cdr (assq ... cont)) "binary")) (insert "\n\n") (insert (or (cdr (assq ... cont)))) (insert "\n"))) ((eq (car cont) 'multipart) (let* ((type (or (cdr ...) "mixed")) (mml-generate-default-type (if (equal type "digest") "message/rfc822" "text/plain")) (handler (assoc type mml-generate-multipart-alist))) (if handler (funcall (cdr handler) cont) (let ((mml-boundary ...)) (insert (format "Content-Type: multipart/%s; boundary=\"%s\"" type mml-boundary) (if ... ... "\n")) (let (... part) (while ... ...)) (insert "\n--" mml-boundary "--\n"))))) (t (error "Invalid element: %S" cont))) (let ((sign-item (assoc (cdr (assq 'sign cont)) mml-sign-alist)) (encrypt-item (assoc (cdr (assq 'encrypt cont)) mml-encrypt-alist)) sender recipients) (if (or sign-item encrypt-item) (progn (if (setq sender (cdr (assq ... cont))) (progn (message-options-set 'mml-sender sender) (message-options-set 'message-sender sender))) (if (setq recipients (cdr (assq ... cont))) (message-options-set 'message-recipients recipients)) (let ((style (mml-signencrypt-style ...))) (if (and sign-item encrypt-item (equal ... ...) (equal style ...)) (funcall (nth 1 encrypt-item) cont t) (if sign-item (progn ...)) (if encrypt-item (progn ...))))))))
  (let ((mm-use-ultra-safe-encoding (or mm-use-ultra-safe-encoding (assq 'sign cont)))) (save-restriction (narrow-to-region (point) (point)) (mml-tweak-part cont) (cond ((or (eq (car cont) 'part) (eq (car cont) 'mml)) (let* ((raw (cdr ...)) (filename (cdr ...)) (type (or ... ...)) (charset (cdr ...)) (coding (mm-charset-to-coding-system charset)) encoding flowed coded) (cond ((eq coding ...) (setq charset nil coding nil)) (charset (setq charset ...))) (if (and (not raw) (member ... ...)) (progn (let ... ...) (mml-insert-mime-headers cont type charset encoding flowed) (insert "\n") (insert coded)) (let (...) (save-current-buffer ... ...)) (mml-insert-mime-headers cont type charset encoding nil) (insert "\n" coded)))) ((eq (car cont) 'external) (insert "Content-Type: message/external-body") (let ((parameters (mml-parameter-string cont ...)) (name (cdr ...)) (url (cdr ...))) (if name (progn (setq name ...) (if ... ... ... ...))) (if url (progn (mml-insert-parameter ... "access-type=url"))) (if parameters (progn (mml-insert-parameter-string cont ...))) (insert "\n\n") (insert "Content-Type: " (or (cdr ...) (if name ... "text/plain")) "\n") (insert "Content-ID: " (message-make-message-id) "\n") (insert "Content-Transfer-Encoding: " (or (cdr ...) "binary")) (insert "\n\n") (insert (or (cdr ...))) (insert "\n"))) ((eq (car cont) 'multipart) (let* ((type (or ... "mixed")) (mml-generate-default-type (if ... "message/rfc822" "text/plain")) (handler (assoc type mml-generate-multipart-alist))) (if handler (funcall (cdr handler) cont) (let (...) (insert ... ...) (let ... ...) (insert "\n--" mml-boundary "--\n"))))) (t (error "Invalid element: %S" cont))) (let ((sign-item (assoc (cdr (assq ... cont)) mml-sign-alist)) (encrypt-item (assoc (cdr (assq ... cont)) mml-encrypt-alist)) sender recipients) (if (or sign-item encrypt-item) (progn (if (setq sender (cdr ...)) (progn (message-options-set ... sender) (message-options-set ... sender))) (if (setq recipients (cdr ...)) (message-options-set 'message-recipients recipients)) (let ((style ...)) (if (and sign-item encrypt-item ... ...) (funcall ... cont t) (if sign-item ...) (if encrypt-item ...))))))))
  mml-generate-mime-1((multipart (type . "alternative") (tag-location . 311) (part (type . "text/plain") (disposition . "inline") (tag-location . 341) (contents . "Matt Price\n\n\nHi ,\n")) (multipart (type . "mixed") (multipart (type . "alternative") (part (type . "text/plain") (disposition . "inline") (contents . #("Matt Price\n\n\nHi ,\n" 0 18 (fontified nil)))) part (type . "text/html") (disposition . "inline") (tag-location . 413) (contents . "<html lang=\"en\"><head><!-- 2020-04-09 Thu 09:10 --...")))))
  (cond ((and (consp (car cont)) (= (length cont) 1)) (mml-generate-mime-1 (car cont))) ((eq (car cont) 'multipart) (mml-generate-mime-1 cont)) (t (mml-generate-mime-1 (nconc (list 'multipart (cons 'type (or multipart-type "mixed"))) cont))))
  (progn (set-buffer-multibyte nil) (setq message-options options) (cond ((and (consp (car cont)) (= (length cont) 1)) (mml-generate-mime-1 (car cont))) ((eq (car cont) 'multipart) (mml-generate-mime-1 cont)) (t (mml-generate-mime-1 (nconc (list 'multipart (cons 'type (or multipart-type "mixed"))) cont)))) (setq options message-options) (buffer-string))
  (unwind-protect (progn (set-buffer-multibyte nil) (setq message-options options) (cond ((and (consp (car cont)) (= (length cont) 1)) (mml-generate-mime-1 (car cont))) ((eq (car cont) 'multipart) (mml-generate-mime-1 cont)) (t (mml-generate-mime-1 (nconc (list 'multipart (cons ... ...)) cont)))) (setq options message-options) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-multibyte nil) (setq message-options options) (cond ((and (consp (car cont)) (= (length cont) 1)) (mml-generate-mime-1 (car cont))) ((eq (car cont) 'multipart) (mml-generate-mime-1 cont)) (t (mml-generate-mime-1 (nconc (list ... ...) cont)))) (setq options message-options) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-multibyte nil) (setq message-options options) (cond ((and (consp ...) (= ... 1)) (mml-generate-mime-1 (car cont))) ((eq (car cont) 'multipart) (mml-generate-mime-1 cont)) (t (mml-generate-mime-1 (nconc ... cont)))) (setq options message-options) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (prog1 (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-multibyte nil) (setq message-options options) (cond ((and ... ...) (mml-generate-mime-1 ...)) ((eq ... ...) (mml-generate-mime-1 cont)) (t (mml-generate-mime-1 ...))) (setq options message-options) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (setq message-options options))
  (if (not cont) nil (if (and (consp (car cont)) (= (length cont) 1) content-type) (progn (setcdr (assq 'type (cdr (car cont))) content-type))) (if (fboundp 'libxml-parse-html-region) (progn (setq cont (mapcar 'mml-expand-all-html-into-multipart-related cont)))) (prog1 (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-multibyte nil) (setq message-options options) (cond (... ...) (... ...) (t ...)) (setq options message-options) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (setq message-options options)))
  (let ((cont (mml-parse)) (mml-multipart-number mml-multipart-number) (options message-options)) (if (not cont) nil (if (and (consp (car cont)) (= (length cont) 1) content-type) (progn (setcdr (assq 'type (cdr (car cont))) content-type))) (if (fboundp 'libxml-parse-html-region) (progn (setq cont (mapcar 'mml-expand-all-html-into-multipart-related cont)))) (prog1 (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-multibyte nil) (setq message-options options) (cond ... ... ...) (setq options message-options) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (setq message-options options))))
jeremy-compostella commented 4 years ago

Have you restarted Emacs properly to load the module cleanly ? Note: I am running with the experimental branch on my old Emacs with the newer mml.el and it works like a charm.

titaniumbones commented 4 years ago

On a clean restart, then manually loading org-msg.el from experimental branch, it works! Thanks. I'm not sure whether you like to leave issues open till fixes are merged, so will leave closing to you as you see fit. Thanks for the fix, it makes a big difference.

jeremy-compostella commented 4 years ago

It makes the org-msg code cleaner with the new changes in Emacs. Unfortunately, I will have to keep the old hack for while as people still run old Emacs version (including me at this point).

I pushed to master.

titaniumbones commented 4 years ago

Awesome thanks!

On Apr. 9, 2020 7:45 p.m., Jérémy Compostella notifications@github.com wrote:

It makes the org-msg code cleaner with the new changes in Emacs. Unfortunately, I will have to keep the old hack for while as people still run old Emacs version (including me at this point).

I pushed to master.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/jeremy-compostella/org-msg/issues/39#issuecomment-611805468, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AACY6NBF6ESFXSYCFE4ZD7DRLZMZXANCNFSM4L2VBOCA.