aboutsummaryrefslogtreecommitdiff
path: root/sx-question-mode.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-11-14 14:16:08 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-11-14 14:16:08 +0000
commitb88fd09f21360c0ceef092efd21251a1aee388ee (patch)
tree5689c4152ed0d5b4bf99ce85f5f4129cb0720803 /sx-question-mode.el
parent8fb8b122811e9125b8eadcbae19e1fbefc403667 (diff)
Fontify when filling
Diffstat (limited to 'sx-question-mode.el')
-rw-r--r--sx-question-mode.el7
1 files changed, 4 insertions, 3 deletions
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.