GNU bug report logs - #61726
[PATCH] Eglot: Support positionEncoding capability

Previous Next

Package: emacs;

Reported by: Augusto Stoffel <arstoffel <at> gmail.com>

Date: Thu, 23 Feb 2023 08:06:01 UTC

Severity: normal

Tags: patch

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #95 received at 61726 <at> debbugs.gnu.org (full text, mbox):

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61726 <at> debbugs.gnu.org, joaotavora <at> gmail.com
Subject: Re: bug#61726: [PATCH] Eglot: Support positionEncoding capability
Date: Fri, 24 Feb 2023 13:01:16 +0100
On Fri, 24 Feb 2023 at 13:27, Eli Zaretskii wrote:

>> > As discussed, position-bytes is incorrect.  You should instead do
>> > something like
>> >
>> >   (length (encode-coding-string
>> >            (buffer-substring-no-properties (point)
>> >                                            (line-beginning-position))
>> >            'utf-8-unix t))
>> 
>> But it is incorrect only if the buffer contains characters outside of
>> the Unicode range, right?  If that happens, we already lost, because a
>> few steps later we will serialize the buffer text as JSON to send it to
>> the server:
>
> Why should one part of the code depend on what another part does?  In
> my book, each part should do its job, and do it right.

Arguably both implementations are wrong, and the correct one should
produce an error if the buffer substring cannot be converted to valid
UTF-8.

Between two “wrong” but perfectly functional implementations, I'd choose
the more efficient one, because efficiency actually matters in this
case.  So which one is more efficient?




This bug report was last modified 2 years and 138 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.