changeset 28087:9ca294cf76c7

(font-lock-keywords): Fix the doc now that regexp-opt-depth is unnecessary. (save-buffer-state): Set an edebug spec. (font-lock-fontify-anchored-keywords): Properly handle the case where the matcher goes past the limit.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 11 Mar 2000 03:50:50 +0000
parents 9ff6e6a6c6b5
children b442dfc3cef0
files lisp/font-lock.el
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/font-lock.el	Sat Mar 11 03:37:37 2000 +0000
+++ b/lisp/font-lock.el	Sat Mar 11 03:50:50 2000 +0000
@@ -119,7 +119,7 @@
 ;;
 ;; Efficient regexps for use as MATCHERs for `font-lock-keywords' and
 ;; `font-lock-syntactic-keywords' can be generated via the function
-;; `regexp-opt', and their depth counted via the function `regexp-opt-depth'.
+;; `regexp-opt'.
 
 ;;; Adding patterns for modes that already support Font Lock:
 
@@ -332,10 +332,10 @@
 where MATCHER can be either the regexp to search for, or the function name to
 call to make the search (called with one argument, the limit of the search) and
 return non-nil if it succeeds (and set `match-data' appropriately).
-MATCHER regexps can be generated via the function `regexp-opt'.  MATCH is the
-subexpression of MATCHER to be highlighted.  MATCH can be calculated via the
-function `regexp-opt-depth'.  FACENAME is an expression whose value is the face
-name to use.  Face default attributes can be modified via \\[customize].
+MATCHER regexps can be generated via the function `regexp-opt'.  MATCH is
+the subexpression of MATCHER to be highlighted.  FACENAME is an expression
+whose value is the face name to use.  Face default attributes can be
+modified via \\[customize].
 
 OVERRIDE and LAXMATCH are flags.  If OVERRIDE is t, existing fontification can
 be overwritten.  If `keep', only parts not already fontified are highlighted.
@@ -638,6 +638,7 @@
 	 (when (and (not modified) (buffer-modified-p))
 	   (set-buffer-modified-p nil)))))
   (put 'save-buffer-state 'lisp-indent-function 1)
+  (def-edebug-spec save-buffer-state let)
   ;;
   ;; Shut up the byte compiler.
   (defvar global-font-lock-mode)	; Now a defcustom.
@@ -1577,9 +1578,10 @@
 	(put-text-property (point) limit 'font-lock-multiline t)))
     (save-match-data
       ;; Find an occurrence of `matcher' before `limit'.
-      (while (if (stringp matcher)
-		 (re-search-forward matcher limit t)
-	       (funcall matcher limit))
+      (while (and (< (point) limit)
+		  (if (stringp matcher)
+		      (re-search-forward matcher limit t)
+		    (funcall matcher limit)))
 	;; Apply each highlight to this instance of `matcher'.
 	(setq highlights lowdarks)
 	(while highlights