From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: "Font-lock is limited to text matching" is a myth Date: Tue, 11 Aug 2009 17:08:18 +0200 Message-ID: References: <7b501d5c0908091634ndfba631vd9db6502db301097@mail.gmail.com> <87my67s8mr.fsf@randomsample.de> <1249942011.29022.15.camel@projectile.siege-engine.com> <1249955428.29022.186.camel@projectile.siege-engine.com> <9c768dc60908102347v57bdf38ara9fe2179f68c07e4@mail.gmail.com> <42D4C5C5-E702-4E30-AB95-A016280F20C7@merrillpress.com> <87r5vipgbs.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1250003331 23130 80.91.229.12 (11 Aug 2009 15:08:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Aug 2009 15:08:51 +0000 (UTC) Cc: emacs-devel@gnu.org, David Engster , Daniel Colascione , Deniz Dogan , Stefan Monnier , Steve Yegge , Leo , Miles Bader To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 11 17:08:42 2009 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 1Masxp-0006f0-1G for ged-emacs-devel@m.gmane.org; Tue, 11 Aug 2009 17:08:37 +0200 Original-Received: from localhost ([127.0.0.1]:40775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Masxn-0000vI-BD for ged-emacs-devel@m.gmane.org; Tue, 11 Aug 2009 11:08:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Masxh-0000tC-M3 for emacs-devel@gnu.org; Tue, 11 Aug 2009 11:08:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Masxc-0000qj-QE for emacs-devel@gnu.org; Tue, 11 Aug 2009 11:08:29 -0400 Original-Received: from [199.232.76.173] (port=44706 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Masxc-0000qS-F6 for emacs-devel@gnu.org; Tue, 11 Aug 2009 11:08:24 -0400 Original-Received: from an-out-0708.google.com ([209.85.132.240]:26616) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MasxZ-0002SB-DU; Tue, 11 Aug 2009 11:08:21 -0400 Original-Received: by an-out-0708.google.com with SMTP id b6so1463796ana.21 for ; Tue, 11 Aug 2009 08:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=o3T1zMAbEoczLhmV1CnyDB6Y16Xhmq1MwCEsLjM/1jo=; b=BHoNDX7sksqMMZeaVgix/Vc+uuTbg53QClLYyvxnU+TFqcGhEO3I2r0sHXxb3c62SC 1QCSjNQ+zcnLFoaoXWvSPA7SeA5Ecp7UmcWNcSjpmGwYFcQ3cVXXGoaLG1pwiUVYZ+6L kn09K0/s+PVL6KvSa/N+cRhqhwODrmD8VKJ0c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=mXb/GGbEEiaixBrY4QmrSf5hfa6a9MrBQoe8+ykQC6QmFW6jc2Gdliz/wsYmwJz6sO /5FITVi6eqFBu8IJxVjqktAQfRGJ9AOxBpMk7lmkE1AdoSCq0EA3hDcwmx25/irRYBwr uti3uaJDvoR2aNcceo8J8bgYgMcZU5Fj8JBOc= Original-Received: by 10.100.45.13 with SMTP id s13mr5456995ans.193.1250003298489; Tue, 11 Aug 2009 08:08:18 -0700 (PDT) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:114062 Archived-At: On Tue, Aug 11, 2009 at 4:53 PM, Daniel Colascione w= rote: > Don't forget the undo entries too. Actually, the full list comes from > font-lock.el: > > (defmacro save-buffer-state (varlist &rest body) > =C2=A0 =C2=A0"Bind variables according to VARLIST and eval BODY restoring= buffer > state." > =C2=A0 =C2=A0(declare (indent 1) (debug let)) > =C2=A0 =C2=A0(let ((modified (make-symbol "modified"))) > =C2=A0 =C2=A0 =C2=A0`(let* ,(append varlist > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0`((,modified (buffer-modified-p)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(buffer-undo-list t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(inhibit-read-only t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(inhibit-point-motion-hooks t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(inhibit-modification-hooks t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0deactivate-mark > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0buffer-file-name > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0buffer-file-truename)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (progn > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ,@body) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless ,modified > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (restore-buffer-modified-p nil))))) And JIT lock takes care of errors too: (defmacro jit-with-buffer-unmodified (&rest body) "Eval BODY, preserving the current buffer's modified state." (declare (debug t)) (let ((modified (make-symbol "modified"))) `(let ((,modified (buffer-modified-p))) (unwind-protect (progn ,@body) (unless ,modified (restore-buffer-modified-p nil)))))) (defmacro with-buffer-prepared-for-jit-lock (&rest body) "Execute BODY in current buffer, overriding several variables. Preserves the `buffer-modified-p' state of the current buffer." (declare (debug t)) `(mumamo-jit-with-buffer-unmodified (let ((buffer-undo-list t) (inhibit-read-only t) (inhibit-point-motion-hooks t) (inhibit-modification-hooks t) deactivate-mark buffer-file-name buffer-file-truename) ,@body)))