]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove mhtml--extend-font-lock-region (Bug#41441)
authorTom Tromey <tom@tromey.com>
Sun, 31 May 2020 16:20:12 +0000 (10:20 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 31 May 2020 16:21:38 +0000 (10:21 -0600)
* lisp/textmodes/mhtml-mode.el (mhtml--extend-font-lock-region):
Remove.
(mhtml-mode): Don't set font-lock-extend-region-functions.

lisp/textmodes/mhtml-mode.el

index b9161d9697e2ebb28419219fbe7740fc394ab96c..1ae07c0a304062665cf3c9317c03de5085f89b29 100644 (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.