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: Mon, 21 Mar 2022 06:54:46 +0000 Message-ID: <87bkxzdccp.fsf@gmail.com> 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="24369"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dgutov@yandex.ru To: 54488@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 21 08:07:37 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 1nWC8e-000684-PK for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Mar 2022 08:07:36 +0100 Original-Received: from localhost ([::1]:33404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWC8Y-0001Ne-O3 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Mar 2022 03:07:35 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWBvX-0008J3-7e for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2022 02:54:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWBvW-0004k6-SU for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2022 02:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nWBvW-0005Cj-MZ for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2022 02:54:02 -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: Mon, 21 Mar 2022 06:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54488 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164784563619989 (code B ref -1); Mon, 21 Mar 2022 06:54:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Mar 2022 06:53:56 +0000 Original-Received: from localhost ([127.0.0.1]:35700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWBvP-0005CK-VJ for submit@debbugs.gnu.org; Mon, 21 Mar 2022 02:53:56 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:52816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWBvO-0005CD-Vw for submit@debbugs.gnu.org; Mon, 21 Mar 2022 02:53:55 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWBvO-000808-Li for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2022 02:53:54 -0400 Original-Received: from [2a00:1450:4864:20::32e] (port=56311 helo=mail-wm1-x32e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWBvM-0004iW-QH for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2022 02:53:54 -0400 Original-Received: by mail-wm1-x32e.google.com with SMTP id n35so6298073wms.5 for ; Sun, 20 Mar 2022 23:53:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3eQ+EsbKXh7t7EQ5jBhJV1MUSZQmB9ojMiA+RwqoWKA=; b=nUZz8Ib/1syC0G6xT546h0HG3ijp7VxiCTOHC3LzbYJyAjgzjW2Rg7lsa6oWE1619s /uPaY3zOuJSyq3GhimtmEJ7pgwfb3wp29S8bVP+OZssq388TARQkvLBrthCNP71YmKty 00rhGzRx0wrx4VIGFkAtP/Q+RiroexQViN3Hq1yU6pXY6yG79ys2tMYjiHxsrIZKFVfn LLe0TDPYZp2kpIxXAFf1JH6eYPTJOxErkN5NG9x5UX1+oWgAIph4tv8tmkqZmbBJ2oN6 a7nzzvtEkmE+NMxoq5RiMpZX3k3HyJ/N5sKegtzj0lp6Ln4rSCSnsnNQMMc1NQO0or9n tiGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3eQ+EsbKXh7t7EQ5jBhJV1MUSZQmB9ojMiA+RwqoWKA=; b=2zTkDF/9gbl3wxYdNz6pgPbqJgQDju3l+moD/vBHbfrdoAv+MYcS+nNdrXAgCyR95o UMi7/x6SE26uMW5rFJR2wjVOhM8zZFBuH+Vp03TYYQD5NklvWecUVY9VEkTOXZiIhEQp kFDFZ80aCibyBZEbPV9Gk9Me5hIf5ECAKgeHVhcfdWki6QW2YPWTlbLUmGyZHVyak4E9 iMkKOWMMzepn19bQuvmZ6PGcpRw3SotSbMknYQwApPhnQiEA9uMlAceK0Uf80mrdxWgd PV06ERrlTY0g8AYhHniGqMHcn1E8tG2THvXNhWEwXahFLUaI+x8Iicea1ZPf7Q3n4x3U KXwA== X-Gm-Message-State: AOAM531DFiEYYhINgB10S6NVJM0aRuH53IhmtkJWUrwQYRdTUzpOmzcU 4xuy0+ouOFsPgAdr0HemMIxi6tBXwZOpng== X-Google-Smtp-Source: ABdhPJzGyTrm1A/88DjYTDZyLKtMVnSewM14Kwvq072TySi4owlAu3htcIrECwkfF+h8D99OvjHe+w== X-Received: by 2002:a05:600c:1f17:b0:38b:b2b3:9faa with SMTP id bd23-20020a05600c1f1700b0038bb2b39faamr25141439wmb.190.1647845631091; Sun, 20 Mar 2022 23:53:51 -0700 (PDT) Original-Received: from krug ([87.196.73.90]) by smtp.gmail.com with ESMTPSA id i15-20020a5d584f000000b00204171ba528sm1149957wrf.109.2022.03.20.23.53.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Mar 2022 23:53:50 -0700 (PDT) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32e (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=joaotavora@gmail.com; helo=mail-wm1-x32e.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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:228650 Archived-At: Hello maintainers, This bug I'm about to describe originated in https://github.com/joaotavora/eglot/issues/860. I reproduced it with: * GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu) commit 88d474308e2 * company-mode, a not-too-recent version (but most recent is the same) * the clangd LSP server 13.0.1 * Eglot d5c7c40bc We are reasonably sure the bug is in Emacs and is a regression from Emacs 27.2. The bug has been "defensively" worked around in the Eglot in its commit f775187115. In short, it seems that in the presence of the overlays created by company-mode and in presence of a narrowing, the move-to-column function does not function the way it used to. It should certainly be possible to reproduce the problem without the reasonably complex Eglot setup, but for the time being this is all I have. =20=20=20=20 ~/Source/Emacs/emacs/src/emacs -Q -f package-initialize -L \ ~/Source/Emacs/company-mode -l company -f global-company-mode -l \ eglot.el ~/tmp/issue-860/args_out_of_range.c -f eglot -f \ display-line-numbers-mode -f toggle-debug-on-error Here's the args_out_of_range.c file. 1 // args_out_of_range.c 2 struct Book { 3 int id; 4 char title[50] 5 } book =3D { 1024, "C" }; 6 7 int main(int argc, char *argv[]) 8 { 9 10 // Error when typing the dot to make "book." 11 book 12 return 0; 13 } When one types the dot after the "book" on line 11, company-mode displays a two-line overlay that visually encompasses line 12 after "book", which has the "return 0;" statement. That line happens to also hold a warning about incorrect syntax, one that starts at column 2. Eglot uses 'move-to-column' to go that precise place and highlight the warning. In Emacs 27.2, move-to-column is unaffected by previous company-mode overlays, even if the current line is being co-used visually by the overlay. It moves to the right buffer position. In Emacs master, this isn't true. It seems to be confounded by the company-mode overlay and moves to eob, _beyond the narrowing_, which eventually breaks Eglot with a backtrace such as this one: Debugger entered--Lisp error: (args-out-of-range # 110 124) encode-coding-region(110 124 utf-16 t) Thanks for your time, Jo=C3=A3o