unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
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:24:38 -0800	[thread overview]
Message-ID: <86h7y0fpnt.fsf@stephe-leake.org> (raw)
In-Reply-To: <831rp5xbtp.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 03 Apr 2020 10:33:54 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> >> I would think that you at least need to parse everything displayed and
>> >> everything before what is displayed.  (You need all prior context.  What
>> >> if someone opened a comment on line 1 and hasn't closed it, for
>> >> example?)
>> >
>> > Each buffer always knows which part of it remains unchanged.  
>> 
>> Only because jit-lock-after-change on after-change-functions updates
>> that knowledge, via the fontified text property. But that in turn
>> assumes that the entire buffer has been fontified, which is typically
>> not the case; I rarely scroll thru an entire file.
>> 
>> Unless there is some other mechanism that maintains change locations?
>
> I meant BEG_UNCHANGED and END_UNCHANGED.

Ah; I was unaware of those. It would be good if these values were
accessible from modules and elisp. That might remove the need for
ada-mode's after-change-functions; I'd have to try it to be sure.
For one thing, ada-mode maintains a list of changed regions, while this
lumps them all together, and includes unchanged text in between. That
would trigger parses that are not actually needed, but that might be a
good trade.

Hmm. Browsing the emacs C source to see if there is such a function (I
didn't find one, but I could have missed it), I found this in keyboard.c:

      /* If the previous command tried to force a specific window-start,
	 forget about that, in case this command moves point far away
	 from that position.  But also throw away beg_unchanged and
	 end_unchanged information in that case, so that redisplay will
	 update the whole window properly.  */

    BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0;

which means BEG_UNCHANGED can indicate changes when there are actually
none. As long as that doesn't happen too often, it's acceptable.

-- 
-- Stephe



  reply	other threads:[~2020-04-03 17:24 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 [this message]
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
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=86h7y0fpnt.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).