all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 05a5a94: Correct calculation of CC Mode's font-lock region.
Date: Mon, 30 Mar 2015 20:34:57 -0400	[thread overview]
Message-ID: <jwvpp7q9frr.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <20150330224848.GB17661@acm.fritz.box> (Alan Mackenzie's message of "Mon, 30 Mar 2015 22:48:48 +0000")

>> Please use the present tense, even for "rename" ;-)
> Do you mean I should change the commit message on that commit?  Can I
> actually do that?

No, what's done is done.

> ensure (start end) covered the location where re-rendering was needed,
> the re-rendering still failed to take place.

How can you tell.  What does "re-render" mean for you?
`jit-lock-force-redisplay' is not meant to re-run font-lock.  It is only
meant to refresh the display so that it reflects the `face' properties
that were already set by an earlier jit-lock run.

> However, when I tried changing L13 to set 'fontified to nil, the
> re-rendering happened even when the location was far before `start'.

Setting it to nil will cause that forces redisplay to not only re-render
the buffer but also re-fontify (i.e. re-run font-lock).  This is a very
different need from the one jit-lock-force-redisplay is designed to address.

> Assuming that jit-lock-force-redisplay is not going to work, it follows
> that any buffer bits to be fontified which come earlier than
> after-change-functions's `beg' need to have their 'fontified text
> property set to nil, and this needs to happen at after-change time
> (during redisplay is too late).  This necessity even applies to
> extending change regions to whole lines.

Yes and no.  The current code indeed has a weakness in that there's no
way for a jit-lock-function (e.g. font-lock) to tell jit-lock which part
of the buffer it actually did re-fontify (so that jit-lock can in turn
use jit-lock-force-redisplay when needed).  I've been meaning to address
this for years, but never got around to it.  This is only a problem when
a change on one line affects the display on a *previous* line (and this is
done via font-lock-extend-region-functions), so it's rarely problematic.

This said, if a change on line N needs some other line M<N to be
refreshed, and yet font-lock-extend-region-functions doesn't move beg
from N to M (because the two don't need to be refreshed at the same
time, for example), there's yet another way to handle it, which is to
use jit-lock-multiline (which affects jit-lock-context's fontification,
so line M will be refreshed after jit-lock-context-time).


        Stefan



  reply	other threads:[~2015-03-31  0:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150330163859.32247.66180@vcs.savannah.gnu.org>
     [not found] ` <E1YcciK-0008Oj-3Q@vcs.savannah.gnu.org>
2015-03-30 21:08   ` [Emacs-diffs] master 05a5a94: Correct calculation of CC Mode's font-lock region Stefan Monnier
2015-03-30 22:48     ` Alan Mackenzie
2015-03-31  0:34       ` Stefan Monnier [this message]
2015-03-31  1:47         ` Stefan Monnier
2015-03-31  0:40       ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=jwvpp7q9frr.fsf-monnier+emacsdiffs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.