diff options
| -rw-r--r-- | lisp/emacs-lisp/syntax.el | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 11cc1988b1f..3294378754a 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el | |||
| @@ -345,23 +345,27 @@ END) suitable for `syntax-propertize-function'." | |||
| 345 | (end (max pos | 345 | (end (max pos |
| 346 | (min (point-max) | 346 | (min (point-max) |
| 347 | (+ start syntax-propertize-chunk-size)))) | 347 | (+ start syntax-propertize-chunk-size)))) |
| 348 | (funs syntax-propertize-extend-region-functions)) | 348 | (first t) |
| 349 | (while funs | 349 | (repeat t)) |
| 350 | (let ((new (funcall (pop funs) start end)) | 350 | (while repeat |
| 351 | ;; Avoid recursion! | 351 | (setq repeat nil) |
| 352 | (syntax-propertize--done most-positive-fixnum)) | 352 | (run-hook-wrapped |
| 353 | (if (or (null new) | 353 | 'syntax-propertize-extend-region-functions |
| 354 | (and (>= (car new) start) (<= (cdr new) end))) | 354 | (lambda (f) |
| 355 | nil | 355 | (let ((new (funcall f start end)) |
| 356 | (setq start (car new)) | 356 | ;; Avoid recursion! |
| 357 | (setq end (cdr new)) | 357 | (syntax-propertize--done most-positive-fixnum)) |
| 358 | ;; If there's been a change, we should go through the | 358 | (if (or (null new) |
| 359 | ;; list again since this new position may | 359 | (and (>= (car new) start) (<= (cdr new) end))) |
| 360 | ;; warrant a different answer from one of the funs we've | 360 | nil |
| 361 | ;; already seen. | 361 | (setq start (car new)) |
| 362 | (unless (eq funs | 362 | (setq end (cdr new)) |
| 363 | (cdr syntax-propertize-extend-region-functions)) | 363 | ;; If there's been a change, we should go through the |
| 364 | (setq funs syntax-propertize-extend-region-functions))))) | 364 | ;; list again since this new position may |
| 365 | ;; warrant a different answer from one of the funs we've | ||
| 366 | ;; already seen. | ||
| 367 | (unless first (setq repeat t)))) | ||
| 368 | (setq first nil)))) | ||
| 365 | ;; Flush ppss cache between the original value of `start' and that | 369 | ;; Flush ppss cache between the original value of `start' and that |
| 366 | ;; set above by syntax-propertize-extend-region-functions. | 370 | ;; set above by syntax-propertize-extend-region-functions. |
| 367 | (syntax-ppss-flush-cache start) | 371 | (syntax-ppss-flush-cache start) |