diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2020-05-11 00:15:15 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2020-05-11 00:15:15 -0400 |
commit | 5601eb231fe1467b2949d7cdc57d8fefb81540e2 (patch) | |
tree | 584517dcab1ad2c7c3104b7679b627ee1b42274c /lisp/emacs-lisp/syntax.el | |
parent | 67bcde188f777e1f884eb46ab3123afa74d8d303 (diff) | |
download | emacs-5601eb231fe1467b2949d7cdc57d8fefb81540e2.tar.gz emacs-5601eb231fe1467b2949d7cdc57d8fefb81540e2.tar.bz2 emacs-5601eb231fe1467b2949d7cdc57d8fefb81540e2.zip |
* lisp/emacs-lisp/syntax.el (syntax-propertize): Use run-hook-wrapped
This way we avoid making assumptions about the content of
syntax-propertize-extend-region-functions
Diffstat (limited to 'lisp/emacs-lisp/syntax.el')
-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'." (end (max pos (min (point-max) (+ start syntax-propertize-chunk-size)))) - (funs syntax-propertize-extend-region-functions)) - (while funs - (let ((new (funcall (pop funs) start end)) - ;; Avoid recursion! - (syntax-propertize--done most-positive-fixnum)) - (if (or (null new) - (and (>= (car new) start) (<= (cdr new) end))) - nil - (setq start (car new)) - (setq end (cdr new)) - ;; If there's been a change, we should go through the - ;; list again since this new position may - ;; warrant a different answer from one of the funs we've - ;; already seen. - (unless (eq funs - (cdr syntax-propertize-extend-region-functions)) - (setq funs syntax-propertize-extend-region-functions))))) + (first t) + (repeat t)) + (while repeat + (setq repeat nil) + (run-hook-wrapped + 'syntax-propertize-extend-region-functions + (lambda (f) + (let ((new (funcall f start end)) + ;; Avoid recursion! + (syntax-propertize--done most-positive-fixnum)) + (if (or (null new) + (and (>= (car new) start) (<= (cdr new) end))) + nil + (setq start (car new)) + (setq end (cdr new)) + ;; If there's been a change, we should go through the + ;; list again since this new position may + ;; warrant a different answer from one of the funs we've + ;; already seen. + (unless first (setq repeat t)))) + (setq first nil)))) ;; Flush ppss cache between the original value of `start' and that ;; set above by syntax-propertize-extend-region-functions. (syntax-ppss-flush-cache start) |