From 06c604503a32943f331404f07dda24deac052832 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 3 Feb 2020 13:27:43 -0500 Subject: [PATCH] Don't auto-fill in latex math/markdonw code blocks Fixes #2453 --- modules/lang/latex/config.el | 7 +++++-- modules/lang/markdown/config.el | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index 7e1e6d101..48a2e19c0 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -48,8 +48,11 @@ If no viewers are found, `latex-preview-pane' is used.") (setq-default TeX-master t) ;; set-up chktex (setcar (cdr (assoc "Check" TeX-command-list)) "chktex -v6 -H %s") - ;; tell emacs how to parse tex files - (setq-hook! 'TeX-mode-hook ispell-parser 'tex) + (setq-hook! 'TeX-mode-hook + ;; tell emacs how to parse tex files + ispell-parser 'tex + ;; Don't auto-fill in math blocks + fill-nobreak-predicate (cons #'texmathp fill-nobreak-predicate)) ;; Enable word wrapping (add-hook 'TeX-mode-hook #'visual-line-mode) ;; Fold TeX macros diff --git a/modules/lang/markdown/config.el b/modules/lang/markdown/config.el index 819bcc3ec..897800e44 100644 --- a/modules/lang/markdown/config.el +++ b/modules/lang/markdown/config.el @@ -48,6 +48,10 @@ capture, the end position, and the output buffer.") (set-lookup-handlers! '(markdown-mode gfm-mode) :file #'markdown-follow-thing-at-point) + (setq-hook! 'markdown-mode-hook + fill-nobreak-predicate (cons #'markdown-code-block-at-point-p + fill-nobreak-predicate)) + ;; HACK Prevent mis-fontification of YAML metadata blocks in `markdown-mode' ;; which occurs when the first line contains a colon in it. See ;; https://github.com/jrblevin/markdown-mode/issues/328.