all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* font-lock patch for automated edits
@ 2008-08-30 14:56 Eric M. Ludlam
  2008-08-31  6:15 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Eric M. Ludlam @ 2008-08-30 14:56 UTC (permalink / raw
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-04-15 22:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-30 14:56 font-lock patch for automated edits Eric M. Ludlam
2008-08-31  6:15 ` Stefan Monnier
2008-09-01  3:07   ` Re[2]: " Eric M. Ludlam
2008-12-28 13:12   ` Eric M. Ludlam
2009-04-15 21:16     ` Stefan Monnier
2009-04-15 22:57       ` Re[2]: " Eric M. Ludlam

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.