unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Cc: bug-cc-mode@gnu.org, martin rudalics <rudalics@gmx.at>,
	Ralf Angeli <angeli@iwi.uni-sb.de>,
	"Richard M. Stallman" <rms@gnu.org>,
	emacs-devel@gnu.org
Subject: Re: font-lock-extend-region
Date: Thu, 23 Mar 2006 15:23:30 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.3.96.1060323145231.325B-100000@acm.acm> (raw)
In-Reply-To: <87ek0vem8c.fsf-monnier+emacs@gnu.org>

Hi, Stefan!

On Tue, 21 Mar 2006, Stefan Monnier wrote:

>>>> What I think we need is a function called from f-l-default-f-region
>>>> which will get a safe starting position at or before L1034.

>>> Agreed.  And I suggested we name it font-lock-extend-region-function.

>> font-lock-extend-region-function is already in use for purpose (i),
>> determining the region to be fontified.

>Yes, I understand that, but I'm trying to understand why you need it and
>whether font-lock-extend-region-function is then the right answer.

I think it's the right answer.

>> I'm saying we also need a distinct function for purpose (ii),
>> determining a safe place to start fontifying a chunk which could
>> easily be in the middle of the region returned by (i).

>I think I need to start over.  IIUC you're trying to handle the "\\\n"
>line-continuation feature, right?

Yes, in essence.

>For that, you need to always font-lock the whole multiline-line at a
>time, right?  So my natural answer (given the hammer I have in my hand)
>is to tell you to put a font-lock-multiline property on the whole
>multiline-line.  My naive understanding says that it should be
>sufficient: no need for font-lock-extend-region anywhere.

OK.  Yes, I think I agree with you now - the font-lock-multiline property
could indeed do this job successfully (that's assuming it can be set on
an arbitrary sequence of characters, not just on entire lines).  It is
marginally less good than f-l-e-r-function in one extreme case:  when the
extended after-change region is large, and consists of two contiguous
"atomic" ranges.  f-l-multiline would force jit-lock to fontify this
atomically, whilst f-l-e-r-function would allow
jit-lock-extend-chunk-function to fontify it as two chunks.

I still think that f-l-extend-region-f is a more natural approach - IMAO,
it is easier for a major mode to use.

Whatever we do, I think we are agreed that we need a major-mode supplied
function that will extend a jit-lock chunk (as opposed to an after-change
region).  Maybe jit-lock-extend-chunk-function taking two arguments, BEG
and END?

[ .... ]

[ talking about the number of times a fontification region is extended to
entire lines:]
>> I think any text region handled by jit-l-f-now cannot avoid being
>> processed by f-l-fontify-region.

>Indeed, as I said, I think it can be removed, although of course we'll then
>have to update glasses-mode first (which registers itself with jit-lock).
>I think glasses-mode and font-lock-mode are the only two to use jit-lock.

>> I don't see this, yet.  If 'fontified is cleared only on the new open
>> paren at position 1055, the display engine calls successively
>>   (jit-lock-function 1055),
>>   (jit-lock-fontify-now 1055 1555),
>>     and (assuming j-l-f-now DOESN'T extend to whole lines)
>>   (run-hook jit-lock-functions 1055 1555),
>>   (font-lock-fontify-region 1055 1555),
>>   (funcall font-lock-fontify-region-function 1055 1555),
>>   (font-lock-default-fontify-region 1055 1555).
>> Here, in f-l-default-f-r, 1055 is set back to 1044 (BOL), and this whole
>> line, 1044 - 1056, gets its face properties rearranged.

>You're right until here.

>> These then get redisplayed.

>But this is what doesn't happen.

>> What am I missing here?

>When the redisplay engine calls jit-lock-function with arg 1055, it has
>already redisplayed all the text until 1054 and changes in the buffer that
>affect text before 1055 will not cause redisplay to restart when
>it finishes.

Ah, got it!  Thanks!

Maybe the extension-to-whole-lines needs to stay in jit-lock-fontify-now
(since _something_ has to clear the 'fontified text property), and it has
to stay in f-l-default-f-region (since jit-lock isn't always enabled).
That only leaves the after-change one to take out.  Maybe.

>        Stefan

-- 
Alan.

  reply	other threads:[~2006-03-23 15:23 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1D94Wo-0006AP-W2@fencepost.gnu.org>
2005-03-09 21:18 ` [sigra@home.se: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows] Alan Mackenzie
2005-03-09 22:35   ` Stefan Monnier
2005-03-10  8:00     ` Alan Mackenzie
2005-03-10 13:01       ` Stefan Monnier
2005-03-10 15:16         ` D. R. E. Moonfire
2005-03-10 17:01           ` Stefan Monnier
2005-03-10 20:09         ` Alan Mackenzie
2005-03-10 20:53           ` Stefan Monnier
2005-03-10 22:42             ` Alan Mackenzie
2005-03-11 20:28           ` Richard Stallman
2005-03-11  1:48       ` Richard Stallman
2005-03-11 19:43         ` Alan Mackenzie
2005-03-10 22:13     ` Martin Stjernholm
2005-03-10 22:59       ` Stefan Monnier
2005-03-11 20:27         ` Richard Stallman
2005-03-13 16:19         ` Martin Stjernholm
2005-03-14  1:07           ` Stefan Monnier
2005-03-19 22:23             ` Martin Stjernholm
2005-03-19 22:30               ` Stefan Monnier
2005-03-11  1:47     ` Richard Stallman
2005-03-11  4:47       ` Stefan Monnier
2005-03-12  0:56         ` Richard Stallman
2005-03-12  1:00           ` Stefan Monnier
2005-03-13 15:30             ` Richard Stallman
2005-03-11  1:46   ` Richard Stallman
2005-03-11  1:46   ` Richard Stallman
2006-02-12 13:06     ` Ralf Angeli
2006-02-12 16:20       ` Stefan Monnier
2006-02-12 22:58         ` Ralf Angeli
2006-02-13 22:10           ` Stefan Monnier
2006-02-14  7:53             ` martin rudalics
2006-02-14 19:00               ` Stefan Monnier
2006-02-14 20:13                 ` martin rudalics
2006-02-14 21:08                   ` Stefan Monnier
2006-02-15 10:17                     ` martin rudalics
2006-02-15 10:38                       ` Ralf Angeli
2006-02-15 14:20                         ` martin rudalics
2006-02-15 14:56                           ` Ralf Angeli
2006-02-15 16:40                             ` martin rudalics
2006-02-15 17:03                               ` Ralf Angeli
2006-02-16 11:10                               ` Alan Mackenzie
2006-02-16 11:54                                 ` Vivek Dasmohapatra
2006-02-16 15:21                                 ` Stefan Monnier
2006-02-16 23:28                                   ` David Kastrup
2006-02-17 14:19                                     ` Stefan Monnier
2006-02-16 17:21                                 ` martin rudalics
2006-02-15 20:44                     ` Alan Mackenzie
2006-02-16  0:40                       ` Stefan Monnier
2006-02-15 20:56                   ` Alan Mackenzie
2006-02-16  8:56                     ` martin rudalics
2006-02-15 20:13               ` Alan Mackenzie
2006-02-16  9:02                 ` martin rudalics
2006-02-14  8:18             ` Werner LEMBERG
2006-02-14  8:49             ` Ralf Angeli
2006-02-14 19:05               ` Stefan Monnier
2006-02-14 21:12                 ` Ralf Angeli
2006-02-15 13:35                   ` Stefan Monnier
2006-02-15 14:05                     ` Ralf Angeli
2006-02-15 14:21                       ` Ralf Angeli
2006-02-15 20:33             ` Alan Mackenzie
2006-02-15 21:13               ` Stefan Monnier
2006-02-15 21:59                 ` Alan Mackenzie
2006-02-16 14:59                 ` Kim F. Storm
2006-02-16 16:37                   ` Stefan Monnier
2006-02-15 19:07         ` Alan Mackenzie
2006-02-15 21:42           ` Ralf Angeli
2006-02-16 11:20             ` Alan Mackenzie
2006-02-16 11:54               ` Ralf Angeli
2006-02-16 15:12                 ` Alan Mackenzie
2006-02-17  7:56                   ` martin rudalics
2006-02-17 11:32                     ` Ralf Angeli
2006-02-17 13:22                       ` martin rudalics
2006-02-17 13:33                         ` Ralf Angeli
2006-02-16 16:32                 ` Stefan Monnier
2006-02-16  0:38           ` Stefan Monnier
2006-02-16  9:51             ` Alan Mackenzie
2006-02-16 16:27               ` Stefan Monnier
2006-02-17  7:48                 ` martin rudalics
2006-02-17 14:36                   ` Stefan Monnier
2006-02-16 18:46               ` martin rudalics
2006-02-16  9:09           ` martin rudalics
2006-02-13  4:40       ` Richard M. Stallman
2006-02-13  5:25         ` Stefan Monnier
2006-02-14  0:39           ` Richard M. Stallman
2006-03-14 19:23         ` Alan Mackenzie
2006-03-14 22:11           ` Stefan Monnier
2006-03-15  8:52             ` martin rudalics
2006-03-15  9:02             ` Ralf Angeli
2006-03-15 10:22               ` Stefan Monnier
2006-03-15 11:40             ` Alan Mackenzie
2006-03-15 16:16               ` Stefan Monnier
2006-03-15 20:20           ` Richard Stallman
2006-03-20  8:16           ` font-lock-extend-region (was: [sigra@home.se: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows]) Stefan Monnier
2006-03-20 13:01             ` Alan Mackenzie
2006-03-20 17:18               ` font-lock-extend-region Stefan Monnier
2006-03-21 16:05                 ` font-lock-extend-region Alan Mackenzie
2006-03-21 21:32                   ` font-lock-extend-region Stefan Monnier
2006-03-23 15:23                     ` Alan Mackenzie [this message]
2006-03-23 16:18                       ` font-lock-extend-region Stefan Monnier
2006-02-15 19:34       ` [sigra@home.se: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows] Alan Mackenzie
2006-02-16  9:07         ` Ralf Angeli
2006-02-16  9:07         ` martin rudalics

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.3.96.1060323145231.325B-100000@acm.acm \
    --to=acm@muc.de \
    --cc=angeli@iwi.uni-sb.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    --cc=rudalics@gmx.at \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).