Mercurial > emacs
changeset 62233:5dfcab314a42
(font-lock-fontify-keywords-region): Use a marker
when trying to ensure forward progress.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 11 May 2005 15:55:16 +0000 |
parents | c41d1071b664 |
children | b484427cfa6b |
files | lisp/ChangeLog lisp/font-lock.el |
diffstat | 2 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Wed May 11 14:07:00 2005 +0000 +++ b/lisp/ChangeLog Wed May 11 15:55:16 2005 +0000 @@ -1,3 +1,8 @@ +2005-05-11 Stefan Monnier <monnier@iro.umontreal.ca> + + * font-lock.el (font-lock-fontify-keywords-region): Use a marker + when trying to ensure forward progress. + 2005-05-11 Chong Yidong <cyd@stupidchicken.com> * mouse-sel.el (mouse-sel-follow-link-p): New function. @@ -18,8 +23,8 @@ (ada-mode): Add ada-adjust-case-skeleton to skeleton-end-hook. * progmodes/ada-stmt.el (ada-adjust-case-skeleton): - Moved to ada-mode.el. - (ada-stmt-mode-hook): Deleted; do the work in ada-mode. + Move to ada-mode.el. + (ada-stmt-mode-hook): Delete; do the work in ada-mode. * cus-edit.el (custom-file): Call file-chase-links.
--- a/lisp/font-lock.el Wed May 11 14:07:00 2005 +0000 +++ b/lisp/font-lock.el Wed May 11 15:55:16 2005 +0000 @@ -1420,6 +1420,7 @@ (let ((case-fold-search font-lock-keywords-case-fold-search) (keywords (cddr font-lock-keywords)) (bufname (buffer-name)) (count 0) + (pos (make-marker)) keyword matcher highlights) ;; ;; Fontify each item in `font-lock-keywords' from `start' to `end'. @@ -1454,12 +1455,14 @@ (while highlights (if (numberp (car (car highlights))) (font-lock-apply-highlight (car highlights)) - (let ((pos (point))) - (font-lock-fontify-anchored-keywords (car highlights) end) - ;; Ensure forward progress. - (if (< (point) pos) (goto-char pos)))) + (set-marker pos (point)) + (font-lock-fontify-anchored-keywords (car highlights) end) + ;; Ensure forward progress. `pos' is a marker because anchored + ;; keyword may add/delete text (this happens e.g. in grep.el). + (if (< (point) pos) (goto-char pos))) (setq highlights (cdr highlights)))) - (setq keywords (cdr keywords))))) + (setq keywords (cdr keywords))) + (set-marker pos nil))) ;;; End of Keyword regexp fontification functions.