aboutsummaryrefslogtreecommitdiff
path: root/sx-question-mode.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-11-14 14:27:05 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-11-14 14:27:05 +0000
commit2d3b595a2f1a3f5c63d04c9353fe7ed4cc129df7 (patch)
treed0b6b4de300dba779daf9dcc6e356b0e836bcb49 /sx-question-mode.el
parentb88fd09f21360c0ceef092efd21251a1aee388ee (diff)
Fill content!
Diffstat (limited to 'sx-question-mode.el')
-rw-r--r--sx-question-mode.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/sx-question-mode.el b/sx-question-mode.el
index 859af98..d170d41 100644
--- a/sx-question-mode.el
+++ b/sx-question-mode.el
@@ -263,12 +263,21 @@ DATA can represent a question or an answer."
(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:]")
- ;; (markdown-pre-region))
+ ;; Do something here
+ (while (null (eobp))
+ ;; Don't fill pre blocks.
+ (unless (sx-question-mode--move-over-pre)
+ (fill-paragraph)
+ (forward-paragraph)))
(buffer-string)))
+(defun sx-question-mode--move-over-pre ()
+ "Non-nil if paragraph at point can be filled."
+ (markdown-match-pre-blocks
+ (save-excursion
+ (skip-chars-forward "\r\n[:blank:]")
+ (point))))
+
(defun sx-question-mode--propertized-display-name (author)
"Return display_name of AUTHOR with `sx-question-mode-author' face."
(sx-assoc-let author