From: Eli Zaretskii <eliz@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: 38049@debbugs.gnu.org, juri@linkov.net
Subject: bug#38049: C mode fontification broken with reposition-window
Date: Wed, 06 Nov 2019 19:13:44 +0200 [thread overview]
Message-ID: <83zhh9exmf.fsf@gnu.org> (raw)
In-Reply-To: <20191105210737.GA6303@ACM> (message from Alan Mackenzie on Tue, 5 Nov 2019 21:07:37 +0000)
> Date: Tue, 5 Nov 2019 21:07:37 +0000
> From: Alan Mackenzie <acm@muc.de>
> Cc: 38049@debbugs.gnu.org
>
> (i) reposition-window narrows to (2758 3940) in
> repos-count-screen-lines.
> (ii) This latter function uses vertical-motion to count the lines.
> (iii) vertical-motion triggers jit-lock fontification.
> (iv) This calls (eventually) c-font-lock-fontify-region.
> (v) c-font-lock-fontify-region attempts to examine buffer text before
> the start of the jit-lock chunk to find syntactic context.
> (vi) This is outside the visible region, so Emacs raises an exception.
> (vii) The exception is caught and discarded by an unwind-protect in
> c-font-lock-fontify-region.
> (viii) The jit-lock chunk remains unfontified.
>
> As Stefan M has sometimes remarked, narrowing is often not a good idea.
Narrowing is part of life.
Why can't c-font-lock-fontify-region be fixed so as not to signal an
error in these cases? If we do, will that fix the original problem?
> It would seem undesirable for the vertical-motion in (iii) to trigger
> font-locking, since it is merely trying to count lines.
vertical-motion calls functions from the display engine, which
fontifies the text it traverses. It doesn't only count lines, it also
counts columns in canonical character width units (i.e. actually in
pixels). So it cannot possibly avoid fontifications because
fontification might affect how many pixels characters take on
display. Fontifications can also affect the line count, if some
fontification code actually puts display properties on the fontified
text -- something that you rarely if ever see, but Lisp programs can
rightfully expect that. So this idea:
> Perhaps there should be a macro `without-fontifying' which could be
> wrapped around this call to vertical-motion, if there isn't such a
> thing anyway.
cannot fly, sorry.
Let's try to fix the problem in c-font-lock-fontify-region instead,
okay?
next prev parent reply other threads:[~2019-11-06 17:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-03 20:28 bug#38049: C mode fontification broken with reposition-window Juri Linkov
[not found] ` <mailman.552.1572813126.13325.bug-gnu-emacs@gnu.org>
2019-11-03 21:27 ` Alan Mackenzie
2019-11-05 21:07 ` Alan Mackenzie
[not found] ` <20191105210737.GA6303@ACM>
2019-11-05 22:10 ` Juri Linkov
2019-11-06 17:13 ` Eli Zaretskii [this message]
2019-11-06 20:56 ` Alan Mackenzie
2019-11-09 14:45 ` Alan Mackenzie
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=83zhh9exmf.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=38049@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=juri@linkov.net \
/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.