diff options
| author | Tom Tromey | 2020-05-31 10:20:12 -0600 |
|---|---|---|
| committer | Tom Tromey | 2020-05-31 10:21:38 -0600 |
| commit | f56830acbfac8ddedafbabc9be379cd197c9d65b (patch) | |
| tree | 27e5f09d4b83edc3d91d8e9e256905ff5886eaa5 | |
| parent | dc4db3ef09dd5851c48421757a5b5e0f439a143e (diff) | |
| download | emacs-f56830acbfac8ddedafbabc9be379cd197c9d65b.tar.gz emacs-f56830acbfac8ddedafbabc9be379cd197c9d65b.zip | |
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.
| -rw-r--r-- | lisp/textmodes/mhtml-mode.el | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el index b9161d9697e..1ae07c0a304 100644 --- a/lisp/textmodes/mhtml-mode.el +++ b/lisp/textmodes/mhtml-mode.el | |||
| @@ -157,54 +157,6 @@ code(); | |||
| 157 | (mhtml--submode-name submode) | 157 | (mhtml--submode-name submode) |
| 158 | ""))) | 158 | ""))) |
| 159 | 159 | ||
| 160 | (defvar font-lock-beg) | ||
| 161 | (defvar font-lock-end) | ||
| 162 | |||
| 163 | (defun mhtml--extend-font-lock-region () | ||
| 164 | "Extend the font lock region according to HTML sub-mode needs. | ||
| 165 | |||
| 166 | This is used via `font-lock-extend-region-functions'. It ensures | ||
| 167 | that the font-lock region is extended to cover either whole | ||
| 168 | lines, or to the spot where the submode changes, whichever is | ||
| 169 | smallest." | ||
| 170 | (let ((orig-beg font-lock-beg) | ||
| 171 | (orig-end font-lock-end)) | ||
| 172 | ;; The logic here may look odd but it is needed to ensure that we | ||
| 173 | ;; do the right thing when trying to limit the search. | ||
| 174 | (save-excursion | ||
| 175 | (goto-char font-lock-beg) | ||
| 176 | ;; previous-single-property-change starts by looking at the | ||
| 177 | ;; previous character, but we're trying to extend a region to | ||
| 178 | ;; include just characters with the same submode as this | ||
| 179 | ;; character. | ||
| 180 | (unless (eobp) | ||
| 181 | (forward-char)) | ||
| 182 | (setq font-lock-beg (previous-single-property-change | ||
| 183 | (point) 'mhtml-submode nil | ||
| 184 | (line-beginning-position))) | ||
| 185 | (unless (eq (get-text-property font-lock-beg 'mhtml-submode) | ||
| 186 | (get-text-property orig-beg 'mhtml-submode)) | ||
| 187 | (cl-incf font-lock-beg)) | ||
| 188 | |||
| 189 | (goto-char font-lock-end) | ||
| 190 | (unless (bobp) | ||
| 191 | (backward-char)) | ||
| 192 | (setq font-lock-end (next-single-property-change | ||
| 193 | (point) 'mhtml-submode nil | ||
| 194 | (line-beginning-position 2))) | ||
| 195 | (unless (eq (get-text-property font-lock-end 'mhtml-submode) | ||
| 196 | (get-text-property orig-end 'mhtml-submode)) | ||
| 197 | (cl-decf font-lock-end))) | ||
| 198 | |||
| 199 | ;; Also handle the multiline property -- but handle it here, and | ||
| 200 | ;; not via font-lock-extend-region-functions, to avoid the | ||
| 201 | ;; situation where the two extension functions disagree. | ||
| 202 | ;; See bug#29159. | ||
| 203 | (font-lock-extend-region-multiline) | ||
| 204 | |||
| 205 | (or (/= font-lock-beg orig-beg) | ||
| 206 | (/= font-lock-end orig-end)))) | ||
| 207 | |||
| 208 | (defun mhtml--submode-fontify-one-region (submode beg end &optional loudly) | 160 | (defun mhtml--submode-fontify-one-region (submode beg end &optional loudly) |
| 209 | (if submode | 161 | (if submode |
| 210 | (mhtml--with-locals submode | 162 | (mhtml--with-locals submode |
| @@ -364,8 +316,6 @@ the rules from `css-mode'." | |||
| 364 | (setq-local syntax-propertize-function #'mhtml-syntax-propertize) | 316 | (setq-local syntax-propertize-function #'mhtml-syntax-propertize) |
| 365 | (setq-local font-lock-fontify-region-function | 317 | (setq-local font-lock-fontify-region-function |
| 366 | #'mhtml--submode-fontify-region) | 318 | #'mhtml--submode-fontify-region) |
| 367 | (setq-local font-lock-extend-region-functions | ||
| 368 | '(mhtml--extend-font-lock-region)) | ||
| 369 | 319 | ||
| 370 | ;; Attach this to both pre- and post- hooks just in case it ever | 320 | ;; Attach this to both pre- and post- hooks just in case it ever |
| 371 | ;; changes a key binding that might be accessed from the menu bar. | 321 | ;; changes a key binding that might be accessed from the menu bar. |