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#54488: 29.0.50; move-to-column/overlay-related regression in latest master, perhaps 28? Date: Tue, 22 Mar 2022 18:53:59 +0200 Message-ID: <83y212dj2w.fsf@gnu.org> 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: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12698"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54488@debbugs.gnu.org, dgutov@yandex.ru To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 22 17:55:59 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 1nWhna-00035Q-M0 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 17:55:58 +0100 Original-Received: from localhost ([::1]:53620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWhnZ-0006wS-Ho for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 12:55:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWhmg-0006UM-IY for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 12:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47852) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWhmg-00011a-94 for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 12:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nWhmg-0004o9-8B for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 12:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Mar 2022 16:55:02 +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.164796806318409 (code B ref 54488); Tue, 22 Mar 2022 16:55:02 +0000 Original-Received: (at 54488) by debbugs.gnu.org; 22 Mar 2022 16:54:23 +0000 Original-Received: from localhost ([127.0.0.1]:41743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWhm2-0004mr-Uj for submit@debbugs.gnu.org; Tue, 22 Mar 2022 12:54:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWhly-0004mc-2M for 54488@debbugs.gnu.org; Tue, 22 Mar 2022 12:54:21 -0400 Original-Received: from [2001:470:142:3::e] (port=41544 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWhls-0008Ls-P9; Tue, 22 Mar 2022 12:54:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=zvDlECi1PiBJPjLIuJnXReKUYky9IQ8HOX/FoCrmhNM=; b=XtosL1PY3OQ1d2t7SQP1 RzD4L5e2nBBsm5nbwWIi21Nm83Zt/rdQV5az2lVakXEPzMsZ0VkOJftuaCTe5zRk5sVk7gn69Srlx pP/LN/gPbQVlgS/t4SfAGJJM/zW6n1dOV6eD+zY/ejHjC92/JLtHkbtj9BBSCQpuiJB4Hw14dkTUe 2g/sR2S/ShmvpuhODtgbWxqkVD5XB01Ed7HJURZ3pPLs+NZoSaE0YOMmidLtU5bVv+qtKiOlz/8qX O3EORY67GpFO6qc+kOsV7TaPtkhjb0gIPxzs1Vly5nqYCL2XAMx4zDPxqOgmAbJTaJs9eqSa053R+ zd3JWiwBtc7yHA==; Original-Received: from [87.69.77.57] (port=4568 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 1nWhls-0001bN-8S; Tue, 22 Mar 2022 12:54:12 -0400 In-Reply-To: (message from =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= on Tue, 22 Mar 2022 16:06:48 +0000) 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:228775 Archived-At: > From: João Távora > Date: Tue, 22 Mar 2022 16:06:48 +0000 > Cc: Dmitry Gutov , 54488@debbugs.gnu.org > > 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 = (line-beginning-position) > > initially > > (narrow-to-region lbp (line-end-position)) > > (move-to-column column) > > for diff = (- column > > (/ (- (length (encode-coding-region (or lbp (line-beginning-position)) > > (point) 'utf-16 t)) ;; <===== 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)))))) I don't see how this could cause the problem you describe, but please note that encode-coding-region generally changes the text in the region, so maybe what you consider to be outside the restriction isn't? Anyway, do you have an example of text in which this function causes point to return such problematic values? > 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? Yes, if you have only text in the buffer (no images etc.).