Fix org-mu4e-compose font locking
This commit is contained in:
@@ -80,6 +80,22 @@ about this change."
|
|||||||
(setq end (match-beginning 0)))
|
(setq end (match-beginning 0)))
|
||||||
(cons (1+ start) end)))))
|
(cons (1+ start) end)))))
|
||||||
|
|
||||||
|
(defun org-mu4e--make-face-font-lock-face (start end)
|
||||||
|
"Copy the value of all `face' text properties to `font-lock-face'.
|
||||||
|
The affected area is START to END in the current buffer."
|
||||||
|
(with-restriction start end
|
||||||
|
(cl-do ((pos (point-min) (next-property-change pos))
|
||||||
|
(begin (point-min))
|
||||||
|
(face (or (get-text-property (point) 'face)
|
||||||
|
'default)))
|
||||||
|
((not pos) (put-text-property begin (point-max) 'font-lock-face face))
|
||||||
|
(let ((new-face (or (get-text-property pos 'face)
|
||||||
|
'default)))
|
||||||
|
(unless (equal face new-face)
|
||||||
|
(put-text-property begin pos 'font-lock-face face)
|
||||||
|
(setq face new-face
|
||||||
|
begin pos))))))
|
||||||
|
|
||||||
(defun org-mu4e--pretty-print-fontify-html-part ()
|
(defun org-mu4e--pretty-print-fontify-html-part ()
|
||||||
"Pretty print and fontify the HTML part of the current buffer."
|
"Pretty print and fontify the HTML part of the current buffer."
|
||||||
(when-let* ((bounds (org-mu4e--bounds-of-mime-part "text/html"))
|
(when-let* ((bounds (org-mu4e--bounds-of-mime-part "text/html"))
|
||||||
@@ -97,6 +113,7 @@ about this change."
|
|||||||
(indent-region (point-min) (point-max)))
|
(indent-region (point-min) (point-max)))
|
||||||
(put-text-property (point-min) (point-max) 'fontified nil)
|
(put-text-property (point-min) (point-max) 'fontified nil)
|
||||||
(font-lock-ensure)
|
(font-lock-ensure)
|
||||||
|
(org-mu4e--make-face-font-lock-face (point-min) (point-max))
|
||||||
(buffer-string))))
|
(buffer-string))))
|
||||||
(delete-region (car bounds) (cdr bounds))
|
(delete-region (car bounds) (cdr bounds))
|
||||||
(goto-char (car bounds))
|
(goto-char (car bounds))
|
||||||
@@ -113,7 +130,7 @@ about this change."
|
|||||||
after-change-functions)))
|
after-change-functions)))
|
||||||
(delete-region (point-min) (point-max))
|
(delete-region (point-min) (point-max))
|
||||||
(insert ascii-content)
|
(insert ascii-content)
|
||||||
(set-text-properties (point-min) (point-max) '(:fontified t))))))
|
(put-text-property (point-min) (point-max) 'font-lock-face 'default)))))
|
||||||
|
|
||||||
(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.
|
||||||
|
|||||||
Reference in New Issue
Block a user