From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.help Subject: Re: How to fontify region according to mode Date: Mon, 16 Aug 2010 16:39:57 +0200 Message-ID: References: <87bp95dsmd.fsf@stats.ox.ac.uk> <874oexdq3f.fsf@stats.ox.ac.uk> <87lj86bsat.fsf@stats.ox.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1281969678 11884 80.91.229.12 (16 Aug 2010 14:41:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 16 Aug 2010 14:41:18 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Dan Davison Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 16 16:41:16 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ol0sD-0007Wa-1X for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Aug 2010 16:41:13 +0200 Original-Received: from localhost ([127.0.0.1]:54655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ol0sC-0003av-GD for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Aug 2010 10:41:12 -0400 Original-Received: from [140.186.70.92] (port=56472 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ol0rN-0003YC-5c for help-gnu-emacs@gnu.org; Mon, 16 Aug 2010 10:40:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ol0rL-00077R-2l for help-gnu-emacs@gnu.org; Mon, 16 Aug 2010 10:40:20 -0400 Original-Received: from mail-qy0-f176.google.com ([209.85.216.176]:38219) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ol0rL-00077C-00 for help-gnu-emacs@gnu.org; Mon, 16 Aug 2010 10:40:19 -0400 Original-Received: by qyk2 with SMTP id 2so1680794qyk.0 for ; Mon, 16 Aug 2010 07:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=jyDPiFcZVXTlhIUOj9KtK0hXi842e6xWruQ+8Ib4dtI=; b=c/bnW7kJOnLUOPxpFDuiI0RfP4ZpQMfbGNIhWEUoOZR2o17kf+xbIxQD2TBCxZOeqB Lx5VhfI1XS2siHnCWN5bx0y0bpzI702V89a7Tchn5sFqLmNj9LwW986saBzg6G594cfP Y+gHPeGUY2e5OqiCELjpgTnhFdBZs2ETfRu80= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=FY0luv69+sw+SsjnYuKTC+Vi6eBfxXvlIMKYpL1lScl4WmQ1Zab90UpleHV+sFQ1xB 81lUQgS5uxDvDcIS6MCLqx5fC4sbZmER5vItD52Kl6TR9cFI/F98frOeUefeNoUiYYX8 CNVrn/riUiD5knVO6vhU7yaWrLuoS5Vl+5TYQ= Original-Received: by 10.229.181.16 with SMTP id bw16mr3691757qcb.183.1281969617312; Mon, 16 Aug 2010 07:40:17 -0700 (PDT) Original-Received: by 10.229.54.80 with HTTP; Mon, 16 Aug 2010 07:39:57 -0700 (PDT) In-Reply-To: <87lj86bsat.fsf@stats.ox.ac.uk> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:74675 Archived-At: On Mon, Aug 16, 2010 at 3:28 PM, Dan Davison wrote= : >> >> Hi Dan, >> >> I am afraid that what you want actually involves the same problem as >> using multiple major modes. Why don't you think so? > > Hi Lennart, > > OK, I see. It looks like I was being naive and thinking it was simpler > than it really is. Seeing as you have worked extensively on this, and as > I have wasted a little bit of time on it, would you mind explaining to > me where my above approach encounters problems? =C2=A0I.e., inside a let > binding, > > 1. bind `font-lock-defaults' to the appropriate value > 2. bind to nil all the other font-lock related variables that > =C2=A0 `font-lock-set-defaults' will change > 3. call `font-lock-set-defaults' > 4. call `font-lock-fontify-region' This is essentially the way it is done in mumamo.el, but you have to do it inside font-lock. Otherwise font-lock will overwrite what you have done.