Fix org-mu4e

This commit is contained in:
2026-07-09 20:37:10 -07:00
parent aee9c876ae
commit 803919761d
+27 -10
View File
@@ -131,16 +131,33 @@ The affected area is START to END in the current buffer."
after-change-functions)))
(insert content))))))
(defun org-mu4e--textify-org-part ()
"Replace the org part of the current buffer with plain text."
(when-let* ((bounds (org-mu4e--bounds-of-mime-part "text/plain")))
(with-restriction (car bounds) (cdr bounds)
(let ((ascii-content (org-export-as 'ascii nil nil t))
(after-change-functions (remq 'jit-lock-after-change
after-change-functions)))
(delete-region (point-min) (point-max))
(insert ascii-content)
(put-text-property (point-min) (point-max) 'font-lock-face 'default)))))
(defun org-mu4e--textify-make-original-message-verbatim ()
"Make the original message of a reply message verbatim."
(goto-char (point-max))
(forward-line 0)
(while (looking-at (rx bol eol))
(forward-line -1))
(when (looking-at (rx bol "> "))
(end-of-line)
(insert "\n#+END_VERSE")
(forward-line -1)
(while (looking-at (rx bol ">" (or " " eol)))
(forward-line -1))
(end-of-line)
(insert "\n#+BEGIN_VERSE"))
(defun org-mu4e--textify-org-part ()
"Replace the org part of the current buffer with plain text."
(when-let* ((bounds (org-mu4e--bounds-of-mime-part "text/plain")))
(with-restriction (car bounds) (cdr bounds)
(org-mu4e--textify-make-original-message-verbatim)
(let* ((org-ascii-quote-margin 0)
(ascii-content (org-export-as 'ascii nil nil t))
(after-change-functions (remq 'jit-lock-after-change
after-change-functions)))
(delete-region (point-min) (point-max))
(insert ascii-content)
(put-text-property (point-min) (point-max) 'font-lock-face 'default))))))
(defun org-mu4e--htmlize-and-cleanup ()
"HTMLize and cleanup the visible portion of the buffer.