aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-12-18 17:49:18 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-12-22 10:46:41 -0200
commitbd15a562109470f1c412f9c32ef7e9ab10c13ec2 (patch)
tree28cf046dcefb1097bdbc881d5ef42b4201d5639f
parentf97bc0633c6803e2f2f7a46d8c814f1bc2763b66 (diff)
Don't fill headlines
-rw-r--r--sx-question-print.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/sx-question-print.el b/sx-question-print.el
index 5fcf015..1b34d2e 100644
--- a/sx-question-print.el
+++ b/sx-question-print.el
@@ -378,6 +378,7 @@ E.g.:
(skip-chars-forward "\r\n[:blank:]")
(let ((first-non-blank (point)))
(dolist (it '(sx-question-mode--skip-and-fontify-pre
+ sx-question-mode--skip-headline
sx-question-mode--skip-comments))
;; If something worked, keep point where it is and return t.
(if (funcall it) (throw 'sx-question-mode-done t)
@@ -446,5 +447,12 @@ font-locking."
;; "Handling means to store any relevant metadata it might be holding."
(markdown-match-comments (line-end-position)))
+(defun sx-question-mode--skip-headline ()
+ "If there's a headline ahead, skip it and return non-nil."
+ (when (or (looking-at-p "^#+ ")
+ (progn (forward-line 1) (looking-at-p "===\\|---")))
+ ;; Returns non-nil.
+ (forward-line 1)))
+
(provide 'sx-question-print)
;;; sx-question-print.el ends here