summaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/markdown-mode.el
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/lisp/markdown-mode.el')
-rw-r--r--.emacs.d/lisp/markdown-mode.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/.emacs.d/lisp/markdown-mode.el b/.emacs.d/lisp/markdown-mode.el
index 08ed4bb..18e1e96 100644
--- a/.emacs.d/lisp/markdown-mode.el
+++ b/.emacs.d/lisp/markdown-mode.el
@@ -1255,6 +1255,21 @@ Function is called repeatedly until it returns nil. For details, see
1255 (unless (and (eq new-start start) (eq new-end end)) 1255 (unless (and (eq new-start start) (eq new-end end))
1256 (cons new-start (min new-end (point-max)))))))) 1256 (cons new-start (min new-end (point-max))))))))
1257 1257
1258(defvar font-lock-beg)
1259(defvar font-lock-end)
1260
1261(defun markdown-font-lock-extend-region ()
1262 "Extend the font-lock region to cover whole blocks.
1263Used in `font-lock-extend-region-functions'. Inline constructs
1264such as bold and italic may span several lines within a block, so
1265fontifying a region that begins or ends in the middle of one
1266would miss the match entirely."
1267 (let ((res (markdown-syntax-propertize-extend-region font-lock-beg font-lock-end)))
1268 (when res
1269 (setq font-lock-beg (car res)
1270 font-lock-end (cdr res))
1271 t)))
1272
1258(defun markdown-font-lock-extend-region-function (start end _) 1273(defun markdown-font-lock-extend-region-function (start end _)
1259 "Used in `jit-lock-after-change-extend-region-functions'. 1274 "Used in `jit-lock-after-change-extend-region-functions'.
1260Delegates to `markdown-syntax-propertize-extend-region'. START 1275Delegates to `markdown-syntax-propertize-extend-region'. START
@@ -4803,7 +4818,8 @@ at the beginning of the block."
4803 while pos-prop 4818 while pos-prop
4804 for lang = (markdown-code-block-lang pos-prop) 4819 for lang = (markdown-code-block-lang pos-prop)
4805 do (progn (when lang (markdown-gfm-add-used-language lang)) 4820 do (progn (when lang (markdown-gfm-add-used-language lang))
4806 (goto-char (next-single-property-change (point) prop))))))) 4821 (goto-char (or (next-single-property-change (point) prop)
4822 (point-max))))))))
4807 4823
4808(defun markdown-insert-foldable-block () 4824(defun markdown-insert-foldable-block ()
4809 "Insert details disclosure element to make content foldable. 4825 "Insert details disclosure element to make content foldable.
@@ -10439,6 +10455,8 @@ rows and columns and the column alignment."
10439 #'markdown-syntax-propertize-extend-region nil t) 10455 #'markdown-syntax-propertize-extend-region nil t)
10440 (add-hook 'jit-lock-after-change-extend-region-functions 10456 (add-hook 'jit-lock-after-change-extend-region-functions
10441 #'markdown-font-lock-extend-region-function t t) 10457 #'markdown-font-lock-extend-region-function t t)
10458 (add-hook 'font-lock-extend-region-functions
10459 #'markdown-font-lock-extend-region t t)
10442 (setq-local syntax-propertize-function #'markdown-syntax-propertize) 10460 (setq-local syntax-propertize-function #'markdown-syntax-propertize)
10443 (syntax-propertize (point-max)) ;; Propertize before hooks run, etc. 10461 (syntax-propertize (point-max)) ;; Propertize before hooks run, etc.
10444 ;; Font lock. 10462 ;; Font lock.