From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Tracking buffer positions across time, without markers (was Re: PL support) Date: Sun, 10 May 2020 15:27:47 -0400 Message-ID: <9e98ccbd-6b01-d076-79eb-6bd06ab803fb@gmail.com> References: <6a2c7d18-344e-fefb-63d5-79a99d0532fc@gmail.com> <942a8cb1-0382-cf83-5ff9-4e776c2660f0@gmail.com> <7f8bdd43-f4d7-e0a8-dcfa-6679215f9d44@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="82523"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 To: Eli Zaretskii , emacs-devel@gnu.org, =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 10 21:28:45 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXrcz-000LM9-MR for ged-emacs-devel@m.gmane-mx.org; Sun, 10 May 2020 21:28:45 +0200 Original-Received: from localhost ([::1]:60280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXrcy-0000lo-Ou for ged-emacs-devel@m.gmane-mx.org; Sun, 10 May 2020 15:28:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXrc8-00008a-ET for emacs-devel@gnu.org; Sun, 10 May 2020 15:27:52 -0400 Original-Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]:39782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXrc6-0003GW-O4; Sun, 10 May 2020 15:27:52 -0400 Original-Received: by mail-qk1-x734.google.com with SMTP id s9so6716190qkm.6; Sun, 10 May 2020 12:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=9TsRyN1kskrQiPZwhhTPnLTFBO/VBHjij3kfWuYVM6s=; b=RhKOyCmoF3vadLw5O+ydsrcGa/VN3x0zk/qs9SXiVIV4CreUllTWOr2ZfEQteO58Zx YZ7J73YQEDvBDP/1bMLvErV6s7Ed0DaC0TuDxWZIxX+yyovsh13ZyBH4TfdZP2g6mMoy 7iPeJodm+4ukdwGErC18Yx6WfN1hS1maxdt/PsdsdoDaFj2090qxviAYyKatdaGzGu67 JpRIdUYfe9EY7ZNBy4P/uNwjzlHAwoen97Mlv/TPQZE0SlGwmMu0fswl6jCCT6Qnr1WH Fy57wP1XrUkTaEhsOtlPjY/pkM1qPpez4bw7oKxk699hSXAajTEUFizhIpJbaKo+n4Ox I6zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9TsRyN1kskrQiPZwhhTPnLTFBO/VBHjij3kfWuYVM6s=; b=Al1oeLPGs+mFDVWvPaO5tBSUxNCUa6UqwVBdJT/1wvdwbgsMEkfV/Go9O82EAZbg0r pKwJq2WJe3Sp9HuUy7eYQvEeqz5Cff2y+w+bctGtMP+VH4XDIbeEedkh2oQT+lYVhhP6 rlNS3hHlpDq3LMObGGnZIttauunehgvwvm6xRb9o9q28cgwiVqh1tCN3ZLp2J6OUQjak ROc3fSJOA2ZsSNszuIp4QSC+ZwFMBJ3x+jcIS/iqhjVZd24Wm8vcWppLpf/0/GAayn1s E3A1dHAlovI1FtgxczrLK+idzqg5P547NDpoxxurGP7hQQX1yrPBE60DvgZhilGf9kxy 6bUA== X-Gm-Message-State: AGi0PuYGGtksObsjFUc9jjfgmostWV/LQOD1SXAtzTM7M16puSiNB7hb C1q/L2L0EbASVbljSyagIdM+mYp0 X-Google-Smtp-Source: APiQypLnhyaFXx+0Hve+rChzKVZq/Lj7nxzrfHV7Gbat5ji5kfqJuy9Oo7+J3QJinkboEV3tkUnHkw== X-Received: by 2002:a37:54d:: with SMTP id 74mr10594157qkf.440.1589138869153; Sun, 10 May 2020 12:27:49 -0700 (PDT) Original-Received: from ?IPv6:2601:184:4180:66e7:4d17:b25e:8d9:2188? ([2601:184:4180:66e7:4d17:b25e:8d9:2188]) by smtp.googlemail.com with ESMTPSA id a16sm6377625qko.92.2020.05.10.12.27.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 May 2020 12:27:48 -0700 (PDT) In-Reply-To: Content-Language: en-GB Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=cpitclaudel@gmail.com; helo=mail-qk1-x734.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:249705 Archived-At: On 10/05/2020 00.32, Eli Zaretskii wrote: > On May 10, 2020 6:45:13 AM GMT+03:00, "Clément Pit-Claudel" wrote: >> On 09/05/2020 19.26, João Távora wrote: >>> This is done with an idle timer, much the way that Flycheck >>> works, I believe. >> >> Yup, it's a longstanding issue in Flycheck ^^ >> >>>> A bit. But this works only if the interaction is fast enough, >> right? (Same for syntax errors: positions may well be outdated by the >> time the errors come back) >> >>> By that time another request is probably already underway. >> >> As long as the requests are fast. With slow checkers (typically, >> proof assistants and automated reasoning tools, a single query can >> easily take a minute — by that point lots can have changed in a >> buffer. >> >> The APIs that make this work in Visual Studio (spans and snapshots) >> are described here: >> https://docs.microsoft.com/en-us/visualstudio/extensibility/inside-the-editor?view=vs-2019 >> >> I'd love to hear opinions on what the proper implementation of this >> would for Emacs be. > > Can you explain why using markers is not a good solution for this? Of course: in brief, because we don't know where to put the markers. The general problem is this: I send the contents of a buffer to a subprocess. Some time later, the subprocess returns a list of positions (offsets from the beginning of the buffer, or line/column pairs, etc). At that point, these positions may be stale, since the contents of the buffer may have changed. I need a way to translate these positions (relative to the old buffer contents) into positions relative to the new buffer contents. Since we don't know beforehand what positions the subprocess will return, I don't think markers can help; right?