From: "Eric M. Ludlam" <eric@siege-engine.com>
To: emacs-devel@gnu.org
Subject: font-lock patch for automated edits
Date: Sat, 30 Aug 2008 10:56:20 -0400 [thread overview]
Message-ID: <200808301456.m7UEuKa9030348@projectile.siege-engine.com> (raw)
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
next reply other threads:[~2008-08-30 14:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-30 14:56 Eric M. Ludlam [this message]
2008-08-31 6:15 ` font-lock patch for automated edits 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808301456.m7UEuKa9030348@projectile.siege-engine.com \
--to=eric@siege-engine.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.