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#54488: 29.0.50; move-to-column/overlay-related regression in latest master, perhaps 28? Date: Tue, 22 Mar 2022 16:06:48 +0000 Message-ID: References: <87bkxzdccp.fsf@gmail.com> <831qyvfpv4.fsf@gnu.org> <83fsnbfd72.fsf@gnu.org> <8735jbc6gj.fsf@gmail.com> <6095582d-7065-8089-e8c7-857f070f8ce2@yandex.ru> <87y212b9nt.fsf@gmail.com> <83a6difahu.fsf@gnu.org> <835yo6f5tu.fsf@gnu.org> <834k3qf48k.fsf@gnu.org> <87r16uavhm.fsf@gmail.com> <83zglidnbs.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d39ebb05dad0c964" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37884"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54488@debbugs.gnu.org, Dmitry Gutov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 22 17:07:24 2022 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 1nWh2X-0009d2-Oa for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 17:07:21 +0100 Original-Received: from localhost ([::1]:42882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWh2W-0000rw-3X for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 12:07:20 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWh2E-0000nn-AN for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 12:07:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47797) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWh2E-0004kq-2Q for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 12:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nWh2D-0003d8-QD for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 12:07:01 -0400 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: Tue, 22 Mar 2022 16:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54488 X-GNU-PR-Package: emacs Original-Received: via spool by 54488-submit@debbugs.gnu.org id=B54488.164796516613889 (code B ref 54488); Tue, 22 Mar 2022 16:07:01 +0000 Original-Received: (at 54488) by debbugs.gnu.org; 22 Mar 2022 16:06:06 +0000 Original-Received: from localhost ([127.0.0.1]:41694 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWh1J-0003bx-Pi for submit@debbugs.gnu.org; Tue, 22 Mar 2022 12:06:06 -0400 Original-Received: from mail-ot1-f50.google.com ([209.85.210.50]:41905) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWh1H-0003bT-AD for 54488@debbugs.gnu.org; Tue, 22 Mar 2022 12:06:04 -0400 Original-Received: by mail-ot1-f50.google.com with SMTP id x8-20020a9d6288000000b005b22c373759so12804031otk.8 for <54488@debbugs.gnu.org>; Tue, 22 Mar 2022 09:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=G1XPhu7xLEy8K4pa566ljZLeGBzwuHnC1MO13sXh3+E=; b=KSz7lb6stOIRRuHq093Vny1esOQP2jPqFNfz03d/anPVQZHw38lg88RoLHNsjRkS3L TuxNVHC28oorTZpFIVAYb1tT75dPkU8ndZRmSawOieieVNZ4bvk35qN9qvOFbVY2akGP 0b+54eDxelMWnkO3BEiNJzF96d+dMlrgHPLprY1hfh1GTkFXYcU/U+3+JXzweK66nG4D R7EisQXRuOKtkGTEeTWhrvdnlPMKLCedHdFnmDYrG83kFsGf4AJ51emdovzZKVuV6EbV L6fAJarw6FgYkBptvlZ1qODhSlBot+f75WF0AIawZd5hDtYTODCAwpRW0Bas1tmMTL9/ R6hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G1XPhu7xLEy8K4pa566ljZLeGBzwuHnC1MO13sXh3+E=; b=p1KgJsOJNBxXrHfXTNckQZ2bhU/gQEFF0cJ9olrEqxeyBtp7WmbxM8YbeRklHCbes+ BUUxVX4q9pu2vp4fK52dEK/unz99uU2fl9LnCcxEQXs9ed0WKrUpr2kwjQ0RTOgIy89J jQSsDb+PlVdMA6XTiIWPafStq5RARZ5kGbiIvayHldlVMZb/ZexT0CYUkkoNG7yFHh1+ /aIfyfljLLe4sLagcTat+F6BP8Tofu668BlvUumi9OhM9bjoPSYcJKOjphahqyd9kZ3t br+1cRBgm4UkhBhhRnWPZ8aYQBNtqP4CXiP2RdSWF3/mkucypHVvll/LTvlKXHBTtq0e nTzg== X-Gm-Message-State: AOAM532/eIZVs4mXNbFF5rue+SdLEgaO27EepG3ORU0iDd1saCHd7IDQ +yGvNzS88mBADPq7yGZWNMck5WZjo6wypwyxHzc= X-Google-Smtp-Source: ABdhPJz0Jjbqm8aFUxa+F8O/zLIuYwBNhLGxeAQCirktRsr8RQpZ95MkkOMhRokRSr7H5DKZfeU60zDykbp08xzps8g= X-Received: by 2002:a9d:6e13:0:b0:5ad:3397:a4ac with SMTP id e19-20020a9d6e13000000b005ad3397a4acmr10084673otr.340.1647965157693; Tue, 22 Mar 2022 09:05:57 -0700 (PDT) In-Reply-To: <83zglidnbs.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:228772 Archived-At: --000000000000d39ebb05dad0c964 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 22, 2022 at 3:22 PM Eli Zaretskii wrote: > > From: Jo=C3=A3o T=C3=A1vora > > Cc: dgutov@yandex.ru, 54488@debbugs.gnu.org > > Date: Tue, 22 Mar 2022 14:54:13 +0000 > > > > In Emacs 29, before the fix, that (point) seems to -- very surprisingly > > -- return something beyond the narrowed region and so > > encode-coding-string will complain with args out of range. > > I don't understand how (point) can return a value outside of the > narrowed region, unless it runs with the narrowing temporarily > disabled. Can you show me the code with that call to 'point' again? > I don't think I see it in your OP. > It's the snippet below. but the indentation probably botched it. I inlined a function in that snippet so you can see the move-to-column and the (point) in the same function (normally they live in different functions). > (defun eglot-move-to-lsp-abiding-column (column) > > "Move to COLUMN abiding by the LSP spec." > > (save-restriction > > (cl-loop > > with lbp =3D (line-beginning-position) > > initially > > (narrow-to-region lbp (line-end-position)) > > (move-to-column column) > > for diff =3D (- column > > (/ (- (length (encode-coding-region (or lbp > (line-beginning-position)) > > (point) 'utf-16 t)) ;; <=3D= =3D=3D=3D=3D > THAT (point) > > 2) > > 2)) > > until (zerop diff) > > do (condition-case eob-err > > (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) > > (end-of-buffer (cl-return eob-err)))))) > > Why do you have to use move-to-column instead of forward-char? > I don't remember! Is it exactly equivalent if you're standing in the beginning of the line? Jo=C3=A3o --=20 Jo=C3=A3o T=C3=A1vora --000000000000d39ebb05dad0c964 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Mar 22, 2022 at 3:22 PM Eli Zaret= skii <eliz@gnu.org> wrote:
> From: Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com>
> Cc: dgutov@yande= x.ru,=C2=A0 = 54488@debbugs.gnu.org
> Date: Tue, 22 Mar 2022 14:54:13 +0000
>
> In Emacs 29, before the fix, that (point) seems to -- very surprisingl= y
> -- return something beyond the narrowed region and so
> encode-coding-string will complain with args out of range.

I don't understand how (point) can return a value outside of the
narrowed region, unless it runs with the narrowing temporarily
disabled.=C2=A0 Can you show me the code with that call to 'point' = again?
I don't think I see it in your OP.

= It's the snippet below. but the indentation probably botched it.
<= div>I inlined a function in that snippet so you can see the move-to-column<= /div>
and the (point) in the same function (normally they live in diffe= rent
functions).

> (defun eglot-move-to-lsp-abiding-column (column)
>=C2=A0 =C2=A0"Move to COLUMN abiding by the LSP spec."
>=C2=A0 =C2=A0(save-restriction
>=C2=A0 =C2=A0 =C2=A0(cl-loop
>=C2=A0 =C2=A0 =C2=A0 with lbp =3D (line-beginning-position)
>=C2=A0 =C2=A0 =C2=A0 initially
>=C2=A0 =C2=A0 =C2=A0 (narrow-to-region lbp (line-end-position))
>=C2=A0 =C2=A0 =C2=A0 (move-to-column column)
>=C2=A0 =C2=A0 =C2=A0 for diff =3D (- column
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= / (- (length (encode-coding-region (or lbp (line-beginning-position))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0= (point) 'utf-16 t))=C2=A0=C2=A0 ;; <=3D=3D=3D=3D=3D THAT (point) >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A02)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 2))
>=C2=A0 =C2=A0 =C2=A0 until (zerop diff)
>=C2=A0 =C2=A0 =C2=A0 do (condition-case eob-err
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(forward-char (/ (if (&= gt; diff 0) (1+ diff) (1- diff)) 2))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(end-of-buffer (cl-return eob-= err))))))

Why do you have to use move-to-column instead of forward-char?

I don't remember! Is it exactly equivalent if y= ou're standing in the beginning of the line?

<= div>Jo=C3=A3o


--
Jo=C3=A3o T=C3=A1vora
--000000000000d39ebb05dad0c964--