unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Vladimir Sedach <vas@oneofus.la>
To: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
Cc: "Eli Zaretskii" <eliz@gnu.org>,
	"João Távora" <joaotavora@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: Tracking buffer positions across time, without markers (was Re: PL support)
Date: Sun, 10 May 2020 17:17:10 -0700	[thread overview]
Message-ID: <87ftc71g1l.fsf@t510.orion.oneofus.la> (raw)
In-Reply-To: <9e98ccbd-6b01-d076-79eb-6bd06ab803fb@gmail.com>


Clément Pit-Claudel <cpitclaudel@gmail.com> writes:
> Since we don't know beforehand what positions the subprocess will
> return, I don't think markers can help; right?

It sounds like the fundamental thing you need here is a function from
the integers 1 to point-max of the buffer as it was when you sent
its contents to the sub-process, to the integers 1 to point-max of
the buffer as it is when the sub-process returns some results.

One naive way to obtain this function is to "snapshot" the buffer by
assigning every character in the buffer a text property with the
value of its position at the time of the snapshot.

A refinement would be to put the text property on tokens. Sticky text
properties would do the right thing when changing identifier names.

Another refinement is to use Stefan's idea of delimiting unmodified
intervals and only add properties in the modified interval.

Text properties are nice because they follow kill/yank. Markers do
not. A problem is that text properties are wiped away by
replace-string and similar.

I can see this displaying confusing and nonsensical results if there
are a lot of edits in the time it take the sub-process to return.

--
Vladimir Sedach
Software engineering services in Los Angeles https://oneofus.la



  parent reply	other threads:[~2020-05-11  0:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09 19:47 Tracking buffer positions across time, without markers (was Re: PL support) Clément Pit-Claudel
2020-05-09 21:38 ` João Távora
2020-05-09 22:22   ` Clément Pit-Claudel
2020-05-09 23:26     ` João Távora
2020-05-10  3:45       ` Clément Pit-Claudel
2020-05-10  4:32         ` Eli Zaretskii
2020-05-10 19:27           ` Clément Pit-Claudel
2020-05-10 19:42             ` Drew Adams
2020-05-10 19:49             ` Eli Zaretskii
2020-05-10 20:52               ` Clément Pit-Claudel
2020-05-11 14:24                 ` Eli Zaretskii
2020-05-11 15:03                   ` Clément Pit-Claudel
2020-05-11 15:25                   ` Stefan Monnier
2020-05-10 20:46             ` Stefan Monnier
2020-05-11  2:27               ` Eli Zaretskii
2020-05-11  3:19                 ` Stefan Monnier
2020-05-11  0:17             ` Vladimir Sedach [this message]
2020-05-11 14:18               ` Clément Pit-Claudel
2020-05-11 15:16                 ` João Távora
2020-05-11 15:33                   ` Clément Pit-Claudel
2020-05-11 15:44                     ` João Távora
2020-05-11 16:02                       ` Clément Pit-Claudel
2020-05-11 16:11                         ` João Távora
2020-05-11 17:20                           ` Stefan Monnier
2020-05-11 14:39               ` Eli Zaretskii

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=87ftc71g1l.fsf@t510.orion.oneofus.la \
    --to=vas@oneofus.la \
    --cc=cpitclaudel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    /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).