From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: emacs-tree-sitter and Emacs
Date: Fri, 03 Apr 2020 09:05:34 -0800 [thread overview]
Message-ID: <86lfncfqjl.fsf@stephe-leake.org> (raw)
In-Reply-To: <83369lxbwn.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 03 Apr 2020 10:32:08 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Stephen Leake <stephen_leake@stephe-leake.org>
>> Date: Thu, 02 Apr 2020 17:55:36 -0800
>>
>> > But why do you need that initial full parse in the first place? Is
>> > parsing parts of the buffer so much harder?
>>
>> Because the parser must see a complete top level grammar statement. In
>> Ada, that's the whole file; a typical file looks like:
>
> OK, so this depends on the language, and is not a universal
> requirement.
Yes.
> the point I think we should take from this is that the font-lock
> infrastructure should not _force_ the parser to always perform a full
> parse, it should delegate that to the parser or to a language-aware
> layer that calls the parser.
Yes.
>> Use case: A c-mode buffer A is currently displayed in a window in a
>> frame, it is syntactically correct, and all displayed faces are correct.
>> In another frame, the user uses 'M-x set-variable' to change the value
>> of font-lock-function-name-face.
>>
>> To update the display, something has to trigger redisplay of buffer A. I
>> don't think using M-x set-variable in a different frame does that.
>
> That's not so. Redisplay is called every time Emacs is about to
> become idle. It just returns almost immediately if it detects that no
> changes happened since last redisplay that require any work. I guess
> this fast return is what you mean by "not triggering redisplay".
Ok.
> Regarding the above use case, I don't think I understand what exactly
> did you mean. First, you cannot use set-variable to modify the value
> of font-lock-function-name-face, because it isn't a defcustom.
> Second, what exactly did you mean to set it to, to cause the effect
> you were talking about? IOW, can you present a complete recipe,
> starting from "emacs -Q", where you make such a change, and then you
> need to switch buffers to cause function names be displayed
> differently? I can tell you that if you replace "M-x set-variable"
> with "M-x customize-face" and change some attribute of
> font-lock-function-name-face, the effect on another frame is
> immediate, which means redisplay takes note of the change and redraws
> the other frame. But I'm not sure this is the same use case you had
> in mind.
Ok. In this case, customize-face causes the redisplay. So your original
objection to the ada-mode face design, which was:
> And they cannot pick up every relevant change; for example, what
> happens if some face used for font-lock is modified?
is moot. Unless some elisp program modifies the variable without using
customize-face, but then that program has the responsibility for forcing
redisplay.
If there are other things that can be changed that should force a
redisplay, but currently don't, I would say that's a bug, either in
ada-mode or elsewhere. So far there have been no bugs filed against
ada-mode for this type if issue.
--
-- Stephe
next prev parent reply other threads:[~2020-04-03 17:05 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 3:23 emacs-tree-sitter and Emacs Jorge Javier Araya Navarro
2020-03-30 13:07 ` Eli Zaretskii
2020-03-30 14:00 ` Stefan Monnier
2020-04-01 0:08 ` Stephen Leake
2020-04-01 0:27 ` Stephen Leake
2020-04-01 13:20 ` Eli Zaretskii
2020-04-01 19:51 ` Stephen Leake
2020-04-02 14:03 ` Eli Zaretskii
2020-04-02 14:27 ` Michael Welsh Duggan
2020-04-02 15:15 ` Eli Zaretskii
2020-04-02 15:24 ` Michael Welsh Duggan
2020-04-02 16:10 ` Eli Zaretskii
2020-04-02 16:19 ` Michael Welsh Duggan
2020-04-02 17:18 ` Yuan Fu
2020-04-02 17:39 ` Stefan Monnier
2020-04-02 18:17 ` Yuan Fu
2020-04-02 18:26 ` Stefan Monnier
2020-04-03 2:16 ` Stephen Leake
2020-04-02 18:29 ` Eli Zaretskii
2020-04-02 18:27 ` Eli Zaretskii
2020-04-02 18:50 ` Michael Welsh Duggan
2020-04-02 19:03 ` Eli Zaretskii
2020-04-02 19:39 ` 조성빈
2020-04-03 6:37 ` Eli Zaretskii
2020-04-03 17:27 ` Stephen Leake
2020-04-02 19:48 ` Stefan Monnier
2020-04-03 2:06 ` Stephen Leake
2020-04-03 7:33 ` Eli Zaretskii
2020-04-03 17:24 ` Stephen Leake
2020-04-03 18:39 ` Eli Zaretskii
2020-04-02 15:33 ` martin rudalics
2020-04-03 1:55 ` Stephen Leake
2020-04-03 4:47 ` Jorge Javier Araya Navarro
2020-04-03 7:32 ` Eli Zaretskii
2020-04-03 17:05 ` Stephen Leake [this message]
2020-04-03 18:19 ` Eli Zaretskii
2020-04-04 0:00 ` Stephen Leake
2020-04-01 13:28 ` Stefan Monnier
2020-03-30 14:11 ` Stefan Monnier
2020-03-30 17:00 ` Jorge Javier Araya Navarro
2020-03-30 17:07 ` Dmitry Gutov
2020-03-30 17:09 ` Jorge Javier Araya Navarro
2020-03-30 17:22 ` Stefan Monnier
2020-03-30 17:34 ` Jorge Javier Araya Navarro
2020-03-30 17:50 ` Stefan Monnier
2020-04-01 0:30 ` Stephen Leake
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=86lfncfqjl.fsf@stephe-leake.org \
--to=stephen_leake@stephe-leake.org \
--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 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).