From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#61726: [PATCH] Eglot: Support positionEncoding capability Date: Sun, 26 Feb 2023 08:03:17 +0200 Message-ID: <83pm9xj74q.fsf@gnu.org> References: <87a614g628.fsf@gmail.com> <83pm9znw0i.fsf@gnu.org> <87lekn9ss3.fsf@gmail.com> <83h6vbntqd.fsf@gnu.org> <878rgn9r6u.fsf@gmail.com> <83edqfnq5u.fsf@gnu.org> <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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33826"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61726@debbugs.gnu.org, joaotavora@gmail.com To: Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 26 07:04:30 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 1pWA98-0008bw-46 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Feb 2023 07:04:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWA8o-0008Qq-5t; Sun, 26 Feb 2023 01:04:10 -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 1pWA8g-0008Q7-MM for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 01:04:05 -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 1pWA8g-0005u7-EM for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 01:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWA8g-000124-9N for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 01:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Feb 2023 06:04:02 +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.16773914023885 (code B ref 61726); Sun, 26 Feb 2023 06:04:02 +0000 Original-Received: (at 61726) by debbugs.gnu.org; 26 Feb 2023 06:03:22 +0000 Original-Received: from localhost ([127.0.0.1]:42166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWA82-00010b-7D for submit@debbugs.gnu.org; Sun, 26 Feb 2023 01:03:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWA7z-00010L-Jc for 61726@debbugs.gnu.org; Sun, 26 Feb 2023 01:03:20 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWA7u-0005l2-DI; Sun, 26 Feb 2023 01:03:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ZNhvGlmeGAJrSp3EU5a0pwPENZnoBy0vkdpOjAIp3Zo=; b=YpBvYRn7IHz8 DQVinlPRinjXXGbQANkyxnECPgrV80/39HZgw3c7IrGHFFnrt/tcZOuWdOY7zqiaWYCUT6N4OVPB+ +UdorZ/3f5RLAoTccHEHigyIpvFCkk0zbnqoa2Ru2fsX7lGV/VZCqMtHW1+3tE6qo9f1lYsevEV6x mBv4zzMiPZKq3NhYtKZfbV9QOLvlyE1EI9/pofQH6AmQ245aTzNiHqnY0paOlfV8bOZO4Sry9S30w tpstuJVh/Su3eyYIN1sVa4x1jWOZGusGxbMzr7ugLL6/HhaGmqhSTKRFmZsCvaPgRoZPiDKWKXhX2 +Ptss8pehJIK4DV+UBK7Ag==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWA7t-0003zj-GY; Sun, 26 Feb 2023 01:03:13 -0500 In-Reply-To: <87sfetgux5.fsf@gmail.com> (message from Augusto Stoffel on Sun, 26 Feb 2023 00:57:42 +0100) 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:256766 Archived-At: > From: Augusto Stoffel > Cc: Eli Zaretskii , 61726@debbugs.gnu.org > Date: Sun, 26 Feb 2023 00:57:42 +0100 > > The linear cousin of "lsp-abiding" is very similar to the > function that Eli wrote: > > (defun eglot-move-to-lsp-abiding-column-linearly (column) > "Move to COLUMN as computed using the LSP `utf-16' criterion." > (let* ((bol (line-beginning-position)) > (goal-char (+ bol column)) > (eol (line-end-position))) > (goto-char bol) > (while (and (< (point) goal-char) > (< (point) eol)) > (if (<= #x010000 (char-after) #x10ffff) > (setq goal-char (1- goal-char))) > (forward-char 1)))) > > It would be very hard to believe they have different performance > characteristics. In fact, in some hastily done tests, I get the > following relative running times: > > eglot-move-to-colum: 1.0 > eglot-move-to-lsp-abiding-column-linearly: 8.4 > eglot-move-to-bytewise-column: 8.0 > eglot-move-to-lsp-abiding-column: 14.4 The current version of eglot-move-to-lsp-abiding-column calls encode-coding-region in the loop, which I guess is the main reason for its being slower.