1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00

Remove mhtml--extend-font-lock-region (Bug#41441)

* lisp/textmodes/mhtml-mode.el (mhtml--extend-font-lock-region):
Remove.
(mhtml-mode): Don't set font-lock-extend-region-functions.
This commit is contained in:
Tom Tromey 2020-05-31 10:20:12 -06:00
parent dc4db3ef09
commit f56830acbf

View File

@ -157,54 +157,6 @@ code();
(mhtml--submode-name submode)
"")))
(defvar font-lock-beg)
(defvar font-lock-end)
(defun mhtml--extend-font-lock-region ()
"Extend the font lock region according to HTML sub-mode needs.
This is used via `font-lock-extend-region-functions'. It ensures
that the font-lock region is extended to cover either whole
lines, or to the spot where the submode changes, whichever is
smallest."
(let ((orig-beg font-lock-beg)
(orig-end font-lock-end))
;; The logic here may look odd but it is needed to ensure that we
;; do the right thing when trying to limit the search.
(save-excursion
(goto-char font-lock-beg)
;; previous-single-property-change starts by looking at the
;; previous character, but we're trying to extend a region to
;; include just characters with the same submode as this
;; character.
(unless (eobp)
(forward-char))
(setq font-lock-beg (previous-single-property-change
(point) 'mhtml-submode nil
(line-beginning-position)))
(unless (eq (get-text-property font-lock-beg 'mhtml-submode)
(get-text-property orig-beg 'mhtml-submode))
(cl-incf font-lock-beg))
(goto-char font-lock-end)
(unless (bobp)
(backward-char))
(setq font-lock-end (next-single-property-change
(point) 'mhtml-submode nil
(line-beginning-position 2)))
(unless (eq (get-text-property font-lock-end 'mhtml-submode)
(get-text-property orig-end 'mhtml-submode))
(cl-decf font-lock-end)))
;; Also handle the multiline property -- but handle it here, and
;; not via font-lock-extend-region-functions, to avoid the
;; situation where the two extension functions disagree.
;; See bug#29159.
(font-lock-extend-region-multiline)
(or (/= font-lock-beg orig-beg)
(/= font-lock-end orig-end))))
(defun mhtml--submode-fontify-one-region (submode beg end &optional loudly)
(if submode
(mhtml--with-locals submode
@ -364,8 +316,6 @@ the rules from `css-mode'."
(setq-local syntax-propertize-function #'mhtml-syntax-propertize)
(setq-local font-lock-fontify-region-function
#'mhtml--submode-fontify-region)
(setq-local font-lock-extend-region-functions
'(mhtml--extend-font-lock-region))
;; Attach this to both pre- and post- hooks just in case it ever
;; changes a key binding that might be accessed from the menu bar.