Some changes to org-mu4e-compose

This commit is contained in:
2026-05-05 15:51:06 -07:00
parent e8c518b094
commit b524126503
+18 -5
View File
@@ -100,7 +100,20 @@ about this change."
(buffer-string)))) (buffer-string))))
(delete-region (car bounds) (cdr bounds)) (delete-region (car bounds) (cdr bounds))
(goto-char (car bounds)) (goto-char (car bounds))
(insert content))))) (let ((after-change-functions (remq 'jit-lock-after-change
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)
(set-text-properties (point-min) (point-max) '(:fontified t))))))
(defun org-mu4e--htmlize-and-cleanup () (defun org-mu4e--htmlize-and-cleanup ()
"HTMLize and cleanup the visible portion of the buffer. "HTMLize and cleanup the visible portion of the buffer.
@@ -112,7 +125,7 @@ This moves point, wrap it in `save-excursion' if that is a problem."
(when (re-search-forward (rx (group (* "\n")) "\n" eos) nil t) (when (re-search-forward (rx (group (* "\n")) "\n" eos) nil t)
(delete-region (match-beginning 1) (delete-region (match-beginning 1)
(match-end 1))) (match-end 1)))
(font-lock-ensure) (org-mu4e--textify-org-part)
(org-mu4e--pretty-print-fontify-html-part)) (org-mu4e--pretty-print-fontify-html-part))
(defvar-keymap org-mu4e--code-preview-mode-map (defvar-keymap org-mu4e--code-preview-mode-map
@@ -505,9 +518,9 @@ This is derived from `org-mode', but it also essentially runs
'org-mu4e-send-and-exit) 'org-mu4e-send-and-exit)
(add-to-list (make-local-variable 'mode-line-misc-info) (add-to-list (make-local-variable 'mode-line-misc-info)
'(:eval (if org-mu4e--html-message-p '(:eval (if org-mu4e--html-message-p
"Text/HTML " "Org/HTML "
"Text Only ")))) "Plain Text "))))
;;;###autoload(derived-mode-add-parents 'org-mu4e-compose-mode '(mu4e-compose-mode)) ;;;###autoload
(derived-mode-add-parents 'org-mu4e-compose-mode '(mu4e-compose-mode)) (derived-mode-add-parents 'org-mu4e-compose-mode '(mu4e-compose-mode))
;;;###autoload ;;;###autoload