From 2d3b595a2f1a3f5c63d04c9353fe7ed4cc129df7 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Fri, 14 Nov 2014 14:27:05 +0000 Subject: Fill content! --- sx-question-mode.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sx-question-mode.el') 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 -- cgit v1.2.3