Re: Forward email error - forward-sexp: Scan error

Subject: Re: Forward email error - forward-sexp: Scan error

Date: Wed, 03 Apr 2024 07:33:12 -0300

To: Jon Fineman,

Cc: Jon Fineman

From: David Bremner

Jon Fineman <> writes:

> Debugger entered--Lisp error: (scan-error "Unbalanced parentheses" 22384 32216)
>   scan-sexps(22384 1)
>   forward-sexp()
>   mml-expand-html-into-multipart-related((part (type . "text/html") (charset . "UTF-8") (nofile . "yes") (tag-location . 907) (contents . "<!DOCTYPE html>\n<!--a71f943b-ab8b-549b-4cb2-514a60...")))
>   mml-expand-all-html-into-multipart-related((part (type . "text/html") (charset . "UTF-8") (nofile . "yes") (tag-location . 907) (contents . "<!DOCTYPE html>\n<!--a71f943b-ab8b-549b-4cb2-514a60...")))
>   mml-expand-all-html-into-multipart-related((multipart (type . "mixed") (tag-location . 883) (part (type . "text/html") (charset . "UTF-8") (nofile . "yes") (tag-location . 907) (contents . "<!DOCTYPE html>\n<!--a71f943b-ab8b-549b-4cb2-514a60..."))))
>   mapcar(mml-expand-all-html-into-multipart-related ((part (type . "text/plain") (contents . "\n-------------------- Start of forwarded message -...")) (multipart (type . "mixed") (tag-location . 883) (part (type . "text/html") (charset . "UTF-8") (nofile . "yes") (tag-location . 907) (contents . "<!DOCTYPE html>\n<!--a71f943b-ab8b-549b-4cb2-514a60..."))) (part (type . "text/plain") (contents . "-------------------- End of forwarded message ----..."))))
>   mml-generate-mime(nil nil)

Is that HTML part confidential? My current guess is that it is
triggering a bug in the HTML parsing in GNUs. The call to forward-sexp
which is failing seems to be used (along with a special syntax table)
for selecting the region to be parsed by libxml. I do not see any
handling of malformed HTML in the corresponding function. Perhaps this
happens somewhere else, but another possibility is there isn't any

If the part is confidential, and you can isolate it, please run it
through some strict syntax checker. It could also be that the
assumptions about <> structure being balanced are violated in various
ways by syntactically correct HTML.

notmuch mailing list --
To unsubscribe send an email to