From b88fd09f21360c0ceef092efd21251a1aee388ee Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Fri, 14 Nov 2014 14:16:08 +0000 Subject: Fontify when filling --- sx-question-mode.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index 94f3d81..859af98 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -237,7 +237,7 @@ DATA can represent a question or an answer." (sx-question-mode--wrap-in-overlay '(face sx-question-mode-content-face) (insert "\n" - (sx-question-mode--fill-string + (sx-question-mode--fill-and-fontify .body_markdown) (propertize sx-question-mode-separator 'face 'sx-question-mode-header)))) @@ -256,12 +256,13 @@ DATA can represent a question or an answer." '(face sx-question-mode-content-face) (mapc #'sx-question-mode--print-comment .comments)))))) -(defun sx-question-mode--fill-string (text) +(defun sx-question-mode--fill-and-fontify (text) "Fill TEXT according to `markdown-mode' and return it." (with-temp-buffer (insert text) (markdown-mode) (goto-char (point-min)) + (font-lock-fontify-region (point-min) (point-max)) ;; ;; Do something here ;; (while (null (eobp)) ;; (skip-chars-forward "\r\n[:blank:]") @@ -291,7 +292,7 @@ Second \"%s\" is replaced with the comment." (substring ;; We fill with three spaces at the start, so the comment is ;; slightly indented. - (sx-question-mode--fill-string + (sx-question-mode--fill-and-fontify (concat " " .body_markdown)) ;; Then we remove the spaces from the first line, since we'll ;; add the username there anyway. -- cgit v1.2.3