emacs-devel
[Top][All Lists]
Advanced

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

font-lock patch for automated edits


From: Eric M. Ludlam
Subject: font-lock patch for automated edits
Date: Sat, 30 Aug 2008 10:56:20 -0400

Hi,

  This patch is for font-lock.el CVS version 1.339.

  I have some tests for the CEDET/Semantic incremental parsing engine.
This test calls 'erase-buffer', and performs edits very quickly, and
was causing font-lock to throw errors in my tests.

  This patch basically protects various determined regions (BEG/END)
from being out of bounds of a buffer.  I'd guess there is a better way
to do it, but this allows my tests to run.

  I also added a couple doc strings as checkdoc was unhappy with this
file.

Thanks
Eric
----------------------------

*** font-lock.el.~1.339.~       2008-06-27 03:34:46.000000000 -0400
--- font-lock.el        2008-08-30 10:24:00.000000000 -0400
***************
*** 1018,1027 ****
--- 1018,1034 ----
    (funcall font-lock-unfontify-buffer-function))
  
  (defun font-lock-fontify-region (beg end &optional loudly)
+   "Fontify the region between BEG and END.
+ Optional argument LOUDLY is passed to the 
`font-lock-fontify-region-function'."
    (font-lock-set-defaults)
+   (when (< beg (point-min)) (setq beg (point-min)))
+   (when (> end (point-max)) (setq end (point-max)))
    (funcall font-lock-fontify-region-function beg end loudly))
  
  (defun font-lock-unfontify-region (beg end)
+   "Unfontify the region between BEG and END."
+   (when (< beg (point-min)) (setq beg (point-min)))
+   (when (> end (point-max)) (setq end (point-max)))
    (save-buffer-state nil
      (funcall font-lock-unfontify-region-function beg end)))
  
***************
*** 1093,1099 ****
                                 font-lock-beg 'font-lock-multiline)
                                (point-min))))
      ;;
!     (when (get-text-property font-lock-end 'font-lock-multiline)
        (setq changed t)
        (setq font-lock-end (or (text-property-any font-lock-end (point-max)
                                                   'font-lock-multiline nil)
--- 1100,1107 ----
                                 font-lock-beg 'font-lock-multiline)
                                (point-min))))
      ;;
!     (when (and (< font-lock-end (point-max))
!              (get-text-property font-lock-end 'font-lock-multiline))
        (setq changed t)
        (setq font-lock-end (or (text-property-any font-lock-end (point-max)
                                                   'font-lock-multiline nil)
***************
*** 1163,1168 ****
--- 1171,1177 ----
  what properties to clear before refontifying a region.")
  
  (defun font-lock-default-unfontify-region (beg end)
+   "Remove text properties between BEG and END."
    (remove-list-of-text-properties
     beg end (append
            font-lock-extra-managed-props




reply via email to

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