From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eric M. Ludlam" Newsgroups: gmane.emacs.devel Subject: font-lock patch for automated edits Date: Sat, 30 Aug 2008 10:56:20 -0400 Message-ID: <200808301456.m7UEuKa9030348@projectile.siege-engine.com> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1220108199 24607 80.91.229.12 (30 Aug 2008 14:56:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 Aug 2008 14:56:39 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 30 16:57:33 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KZRtK-0005VA-K8 for ged-emacs-devel@m.gmane.org; Sat, 30 Aug 2008 16:57:30 +0200 Original-Received: from localhost ([127.0.0.1]:39668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZRsM-0002F5-3U for ged-emacs-devel@m.gmane.org; Sat, 30 Aug 2008 10:56:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KZRsG-0002Cq-Tr for emacs-devel@gnu.org; Sat, 30 Aug 2008 10:56:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KZRsE-00029r-Ok for emacs-devel@gnu.org; Sat, 30 Aug 2008 10:56:23 -0400 Original-Received: from [199.232.76.173] (port=45174 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZRsE-00029n-LV for emacs-devel@gnu.org; Sat, 30 Aug 2008 10:56:22 -0400 Original-Received: from static-71-184-83-10.bstnma.fios.verizon.net ([71.184.83.10]:34637 helo=projectile.siege-engine.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KZRsD-0002tg-T4 for emacs-devel@gnu.org; Sat, 30 Aug 2008 10:56:22 -0400 Original-Received: from projectile.siege-engine.com (localhost.localdomain [127.0.0.1]) by projectile.siege-engine.com (8.12.8/8.12.8) with ESMTP id m7UEuKWB030350 for ; Sat, 30 Aug 2008 10:56:21 -0400 Original-Received: (from zappo@localhost) by projectile.siege-engine.com (8.12.8/8.12.8/Submit) id m7UEuKa9030348; Sat, 30 Aug 2008 10:56:20 -0400 X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:103267 Archived-At: 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