From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry OReilly Newsgroups: gmane.emacs.devel Subject: Fontifying outside of region passed to registered JIT lock function Date: Fri, 15 Nov 2013 10:47:46 -0500 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b472078a100ab04eb391ee6 X-Trace: ger.gmane.org 1384530470 18946 80.91.229.3 (15 Nov 2013 15:47:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Nov 2013 15:47:50 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 15 16:47:55 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VhLcg-0007gA-Gx for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2013 16:47:54 +0100 Original-Received: from localhost ([::1]:60885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhLcf-0001EW-Sf for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2013 10:47:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhLcc-0001DS-AL for emacs-devel@gnu.org; Fri, 15 Nov 2013 10:47:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VhLcZ-0005nf-Hg for emacs-devel@gnu.org; Fri, 15 Nov 2013 10:47:50 -0500 Original-Received: from mail-ob0-x236.google.com ([2607:f8b0:4003:c01::236]:60212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhLcZ-0005nW-6s for emacs-devel@gnu.org; Fri, 15 Nov 2013 10:47:47 -0500 Original-Received: by mail-ob0-f182.google.com with SMTP id wp18so4047917obc.13 for ; Fri, 15 Nov 2013 07:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=l3ZuKX0WollSXuk0HmWWzypAUTEULh7bC56rXFudO8M=; b=dDBfjJmeNYrl8TTzmJSqepsZJA5rVt0QdleFS8mbjRT2J4vAc/dzP3kWTaKigwC+4s 5jhX0VH8e+TxVJIuP2Liu1bfaG3rEwiw+fjF9eL9UiE/gODGnBCTunt1kDyBtiv+PWdz eHv1YQb0lpIVckpp9tTNVm1oInkk978AyAb/KVzGiY1k1GHoVs9fuU0bHvniyOGNhWEa CpmecjHdQroKAOD7PXITpr7o1EUy3LF87Xo1ZzDV20eO8UAtXMGcz8IWhbYjFv6OkzVo K6ghwNN7k4BR1fT0oU04+Tv5mI9v9yh2Db09y/xPsJuoq11bA3yxq7YRPPDwYa0hnC/x uuEg== X-Received: by 10.60.133.233 with SMTP id pf9mr7664943oeb.46.1384530466371; Fri, 15 Nov 2013 07:47:46 -0800 (PST) Original-Received: by 10.76.156.103 with HTTP; Fri, 15 Nov 2013 07:47:46 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:165269 Archived-At: --047d7b472078a100ab04eb391ee6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Background: I'm writing a color-parens minor mode that will fontify parens if they are inconsistent with indentation. For example: (if region (setq beg (min jit-lock-start (car region)) end (max jit-lock-end (cdr region)))) Indentation implies the close paren of (setq ...) would be at the end of the same line, but it's really on the next line, so the minor mode fontifies that. The goal is to give the user clues when indentation lies about where close parens are. Problem: I am passing my color-parens-propertize-region function to jit-lock-register and it processes the regions passed to it. However, the regions need expansion because it's possible parent lists' parens outside the region need fontification too. I found the Elisp manual's section on Multiline Font Lock Constructs and tried adding a hook to font-lock-extend-region-functions to expand the region. I discovered that doesn't work because font-lock-fontify-region-function and font-lock-extend-region-functions are used under font-lock-fontify-region, which is another registered JIT lock function. Those region expansions don't apply to the other registered jit-lock-functions. Obviously I could disregard the region inputs and fontify minimally outside of it, but my concerns are: =95 Maybe the JIT lock infrastructure expects jit-lock-functions to fontify only within the region? =95 It might be needlessly inefficient to fontify outside the region without JIT lock knowing, then it calls the jit-lock-functions again for those regions. I found the jit-lock-after-change-extend-region-functions, but those hooks aren't called for the initial fontifications. What is the recommended way to expand the JIT region or otherwise fontify outside of the regions passed to a registered JIT lock function? --047d7b472078a100ab04eb391ee6 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
Background:

I'm writing a color-parens minor mo= de that will fontify parens if they
are inconsistent with indentation. F= or example:

=A0=A0 (if region
=A0=A0=A0=A0=A0=A0 (setq beg (min j= it-lock-start (car region))
=A0=A0=A0=A0=A0=A0 end (max jit-lock-end (cdr region))))

Indentation= implies the close paren of (setq ...) would be at the end
of the same l= ine, but it's really on the next line, so the minor mode
fontifies t= hat. The goal is to give the user clues when indentation
lies about where close parens are.

Problem:

I am passing my c= olor-parens-propertize-region function to
jit-lock-register and it proce= sses the regions passed to it. However,
the regions need expansion becau= se it's possible parent lists' parens
outside the region need fontification too.

I found the Elisp manual&= #39;s section on Multiline Font Lock Constructs
and tried adding a hook = to font-lock-extend-region-functions to expand
the region. I discovered = that doesn't work because
font-lock-fontify-region-function and
font-lock-extend-region-functions = are used under
font-lock-fontify-region, which is another registered JIT= lock
function. Those region expansions don't apply to the other reg= istered
jit-lock-functions.

Obviously I could disregard the region inputs an= d fontify minimally
outside of it, but my concerns are:

=A0=A0 = =95 Maybe the JIT lock infrastructure expects jit-lock-functions to
=A0= =A0=A0=A0 fontify only within the region?

=A0=A0 =95 It might be needlessly inefficient to fontify outside the re= gion
=A0=A0=A0=A0 without JIT lock knowing, then it calls the jit-lock-f= unctions
=A0=A0=A0=A0 again for those regions.

I found the jit-lo= ck-after-change-extend-region-functions, but those
hooks aren't called for the initial fontifications.

What is the = recommended way to expand the JIT region or otherwise
fontify outside of= the regions passed to a registered JIT lock
function?


--047d7b472078a100ab04eb391ee6--