[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes
From: |
Dmitry Gutov |
Subject: |
Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049. |
Date: |
Tue, 12 Nov 2019 15:36:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
Hi Alan,
On 11.11.2019 22:34, Alan Mackenzie wrote:
On Mon, Nov 11, 2019 at 18:52:34 +0200, Dmitry Gutov wrote:
On 09.11.2019 16:40, Alan Mackenzie wrote:
+ (widen)
Could you try and honor font-lock-dont-widen here?
Difficult. In CC Mode it is sometimes necessary to enlarge a font lock
region so as to get the context needed to parse some element of the
buffer. This was what gave rise to the bug.
Did that really happen in the reported scenario? I mean,
font-lock-dont-widen is usually nil, so font-lock will call widen for
you already.
In all of Emacs, there's just one use of font-lock-dont-widen, in
rmail.el, and that is almost certainly for a different reason than your
use of it (which is, I believe, having several major modes in a single
buffer).
Does RMail use it for quoted pirces of code? If so, it would be similar.
Could you, perhaps, suggest some alternative to using widen in
c-font-lock-fontify-region? Some way which would still work for CC Mode
(including the just fixed bug), but wouldn't adversely affect the
several major mode code you're maintaining? Would it be possible to
widen "a bit" rather than widening to the whole buffer? If so, how
would I determine the bit to widen to?
Not sure what difference the supposed "bit" would make (and thus, how
would mmm-mode determine it). But I think that would depend on your
answer to my first question in this email. Because, I think, normally
you don't "have to" widen at all, font-lock will do that for you.
In mmm-mode context, however, we apply definite boundaries to the region
chunks. Here's an example of some Noweb code:
https://en.wikipedia.org/wiki/Noweb#Example_of_a_simple_noweb_program
The inside of hello.c block would be narrowed to.
Now, I have remembered that CC Mode calls widen from many places
already, so it already is problematic for using in a context like that.
Thus this particular change doesn't change the picture much, and so
please feel free to drop this conversation at any point of time.
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/11
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Alan Mackenzie, 2019/11/11
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049.,
Dmitry Gutov <=
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Alan Mackenzie, 2019/11/13
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/13
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Stefan Monnier, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/14