emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/font-lock.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/font-lock.el,v
Date: Mon, 07 Aug 2006 17:42:37 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        06/08/07 17:42:36

Index: font-lock.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/font-lock.el,v
retrieving revision 1.301
retrieving revision 1.302
diff -u -b -r1.301 -r1.302
--- font-lock.el        3 Aug 2006 07:14:38 -0000       1.301
+++ font-lock.el        7 Aug 2006 17:42:36 -0000       1.302
@@ -976,7 +976,7 @@
 ;; multi-line strings and comments; regexps are not appropriate for the job.)
 
 (defvar font-lock-extend-after-change-region-function nil
-  "A function that determines the region to fontify after a change.
+  "A function that determines the region to refontify after a change.
 
 This variable is either nil, or is a function that determines the
 region to refontify after a change.
@@ -985,7 +985,7 @@
 
 The function is given three parameters, the standard BEG, END, and OLD-LEN
 from `after-change-functions'.  It should return either a cons of the beginning
-and end buffer positions \(in that order) of the region to fontify, or nil
+and end buffer positions \(in that order) of the region to refontify, or nil
 \(which directs the caller to fontify a default region).
 This function should preserve the match-data.
 The region it returns may start or end in the middle of a line.")
@@ -1044,6 +1044,12 @@
 (defvar font-lock-beg) (defvar font-lock-end)
 (defvar font-lock-extend-region-functions
   '(font-lock-extend-region-wholelines
+    ;; This use of font-lock-multiline property is unreliable but is just
+    ;; a handy heuristic: in case you don't have a function that does
+    ;; /identification/ of multiline elements, you may still occasionally
+    ;; discover them by accident (or you may /identify/ them but not in all
+    ;; cases), in which case the font-lock-multiline property can help make
+    ;; sure you will properly *re*identify them during refontification.
     font-lock-extend-region-multiline)
   "Special hook run just before proceeding to fontify a region.
 This is used to allow major modes to help font-lock find safe buffer positions
@@ -1177,6 +1183,12 @@
                 end (max jit-lock-end (cdr region))))
       ;; Then extend the region obeying font-lock-multiline properties,
       ;; indicating which part of the buffer needs to be refontified.
+      ;; !!! This is the *main* user of font-lock-multiline property !!!
+      ;; font-lock-after-change-function could/should also do that, but it
+      ;; doesn't need to because font-lock-default-fontify-region does
+      ;; it anyway.  Here OTOH we have no guarantee that
+      ;; font-lock-default-fontify-region will be executed on this region
+      ;; any time soon.
       (when (and (> beg (point-min))
                  (get-text-property (1- beg) 'font-lock-multiline))
         (setq beg (or (previous-single-property-change




reply via email to

[Prev in Thread] Current Thread [Next in Thread]