From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#61726: [PATCH] Eglot: Support positionEncoding capability Date: Sun, 26 Feb 2023 14:17:39 +0000 Message-ID: <87r0ucpl30.fsf@gmail.com> References: <87a614g628.fsf@gmail.com> <83bkljnpck.fsf@gnu.org> <874jrb9l6d.fsf@gmail.com> <834jrbnlaf.fsf@gnu.org> <87v8jr83ic.fsf@gmail.com> <83v8jrm4r0.fsf@gnu.org> <87fsav7x81.fsf@gmail.com> <83a612ko73.fsf@gnu.org> <87ttza3rwh.fsf@gmail.com> <83356tluvq.fsf@gnu.org> <87a61125ox.fsf@gmail.com> <83wn45k8yu.fsf@gnu.org> <874jr9z94m.fsf@gmail.com> <87y1olv0h1.fsf@gmail.com> <87sfetgux5.fsf@gmail.com> <83pm9xj74q.fsf@gnu.org> <83v8joimo9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34800"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61726@debbugs.gnu.org, arstoffel@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 26 15:16:23 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pWHp8-0008wV-PI for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Feb 2023 15:16:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWHow-000573-LT; Sun, 26 Feb 2023 09:16:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWHoq-00056g-EB for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 09:16:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWHoo-0008Pn-8X for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 09:16:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWHoo-0000iM-0J for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 09:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Feb 2023 14:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61726 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 61726-submit@debbugs.gnu.org id=B61726.16774209572733 (code B ref 61726); Sun, 26 Feb 2023 14:16:01 +0000 Original-Received: (at 61726) by debbugs.gnu.org; 26 Feb 2023 14:15:57 +0000 Original-Received: from localhost ([127.0.0.1]:42789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWHoi-0000i0-Iz for submit@debbugs.gnu.org; Sun, 26 Feb 2023 09:15:56 -0500 Original-Received: from mail-wr1-f45.google.com ([209.85.221.45]:42766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWHof-0000hc-3Y for 61726@debbugs.gnu.org; Sun, 26 Feb 2023 09:15:55 -0500 Original-Received: by mail-wr1-f45.google.com with SMTP id j2so3659026wrh.9 for <61726@debbugs.gnu.org>; Sun, 26 Feb 2023 06:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677420947; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sB6EsleyjUbRyF8j4WAT//3gLhUa4C91S0L3G/IbMZs=; b=MmsXsD7bMQfOmwwZeAbC0AKw2FqDtoDP3z0OQIG5iFvXHE+Ie6eOqD9PAcMp9eDH4D FYxGLuAI+c8+O9Zw8n0Iv2HV6bD21JPC/sQpNCHldDmWWWCwy/UjEVY0ZAgvCJBwDpl2 ALOoxu+MDAe6lDtLb635epp2Wxi7xZJzXLiFh+nF/3RqQmde57KzezJ6oEThiN4njxBe 8ZvtsFi2EduqvvquTjLm9DPy+TW9lsAg3hfffnXvzNIE0PvOczm2pQqv2q8LDzvMbgkI TsuQsITPOXr/i6VWYZHyPtuUsDz7OUg+kAaPWCIQG/rDc42a2ZCHCMeSqSKNQ3ctppPf 6Ubg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677420947; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=sB6EsleyjUbRyF8j4WAT//3gLhUa4C91S0L3G/IbMZs=; b=WZesaKZRwhYAE+4DO1jzs4iHnMstbNoMU5LgJOobQ6jKpYtMQ8cf87O7ark1Kzwk7y A3+abaFP0F+wMNQJSLuY2hhyvGu23xsbSKHyJLG60xQ8EsdcA4fsno2gPiznm3fmZz9C cxGZZNRXrdzYuhzWjB8jWhz+1tTCmfUK4gCnJr9JOxbCqkaBg+uvZSZTsqMA2d9bvhSd FE3zg1KuYyoIWAe863c1ziOoaRzfnKj+ioMzxqD/OGcuiQunb5lqwH6e9XGYmE2gi9AD u7PMkoz+LYFfsobHag+LcLGGN3uFd5HO9USfYerv7a+xO2jgwSI9QG4KZITA3tHHAzUq iTeQ== X-Gm-Message-State: AO0yUKWROJsh8iR+1few0Bxh9C3YHALasE5s0iW4Y22cJy+6IL6doRWj YUETTTtfe5pNv13P0OgimlcqE8yr+08= X-Google-Smtp-Source: AK7set8e07HUJqoMckKoE2/n7Mh8f2fEEfJDpFST17VdPQUPg8V1mQDEtvZ0ul4ohIhp3OOdxtRkcw== X-Received: by 2002:adf:dc09:0:b0:2ca:f86a:9643 with SMTP id t9-20020adfdc09000000b002caf86a9643mr1055420wri.0.1677420946769; Sun, 26 Feb 2023 06:15:46 -0800 (PST) Original-Received: from krug (87-196-72-142.net.novis.pt. [87.196.72.142]) by smtp.gmail.com with ESMTPSA id o8-20020a5d4a88000000b002c70c99db74sm4451691wrq.86.2023.02.26.06.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 06:15:45 -0800 (PST) In-Reply-To: <83v8joimo9.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 26 Feb 2023 15:25:10 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256803 Archived-At: Eli Zaretskii writes: >> From: Jo=C3=A3o T=C3=A1vora >> Date: Sun, 26 Feb 2023 13:13:16 +0000 >> Cc: Augusto Stoffel , 61726@debbugs.gnu.org >>=20 >> * Pushed a renaming/redocumenting obsoletion-establishing patch. Now >> Eglot talks of "linepos" instead of "column". > > I've corrected a few doc strings to use a more widely-familiar > terminology. Thanks, but at one of the corrections is mistaken, so I've fixed it like this. (defvar eglot-current-linepos-function #'eglot-utf-16-linepos - "Function calculating number of UTF-16 code units from line beginnin= g. + "Function calculating number of code units from line beginning. =20=20=20=20=20 This is the inverse operation of `eglot-move-to-linepos-function' (which see). It is a function of This variable is set by default to a function that indeed does UTF-16 calculations. But it can and will be set to one that does UTF-32 or UTF-8 codepoint calculations, depending on the server. I also have a few nits. In your patch: (defun eglot-utf-32-linepos () - "Calculate number of code units to line beginning using UTF-32." + "Calculate number of Unicode codepoints from line beginning." (- (point) (line-beginning-position))) This is strictly true, because in UTF-32 it's one code point per code unit. But the protocol of the variable 'eglot-current-linepos-function', where this function is to be plugged, a code-unit counting function is demanded. I would predict that encoding-challenged programmers (like this package's maintainer in about 2 week's time) might not know about that equivalence and will find it slightly confusing to plug this function into that variable. But as I said this is just a nit. Jo=C3=A3o