unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#54488: 29.0.50; move-to-column/overlay-related regression in latest master, perhaps 28?
@ 2022-03-21  6:54 João Távora
  2022-03-21 12:32 ` Eli Zaretskii
  0 siblings, 1 reply; 32+ messages in thread
From: João Távora @ 2022-03-21  6:54 UTC (permalink / raw)
  To: 54488; +Cc: dgutov

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.
    
  ~/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 = { 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 #<buffer args_out_of_range.c> 110 124)
  encode-coding-region(110 124 utf-16 t)

Thanks for your time,
João







^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2022-03-24 16:59 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21  6:54 bug#54488: 29.0.50; move-to-column/overlay-related regression in latest master, perhaps 28? João Távora
2022-03-21 12:32 ` Eli Zaretskii
2022-03-21 16:37   ` João Távora
2022-03-21 17:05     ` Eli Zaretskii
2022-03-21 21:59       ` João Távora
2022-03-21 23:14         ` Dmitry Gutov
2022-03-22  9:48           ` João Távora
2022-03-22 12:16             ` Eli Zaretskii
2022-03-22 13:57               ` Eli Zaretskii
2022-03-22 14:31                 ` Eli Zaretskii
2022-03-22 14:54                   ` João Távora
2022-03-22 15:22                     ` Eli Zaretskii
2022-03-22 16:06                       ` João Távora
2022-03-22 16:53                         ` Eli Zaretskii
2022-03-22 21:05                           ` João Távora
2022-03-22 23:55                             ` Dmitry Gutov
2022-03-23  1:11                               ` João Távora
2022-03-23  3:39                                 ` Eli Zaretskii
2022-03-23 10:10                                   ` João Távora
2022-03-23 11:08                                     ` João Távora
2022-03-23 14:21                                       ` Eli Zaretskii
2022-03-24 15:01                                         ` João Távora
2022-03-24 15:29                                           ` Eli Zaretskii
2022-03-24 16:03                                             ` João Távora
2022-03-24 16:59                                               ` Eli Zaretskii
2022-03-23  3:34                               ` Eli Zaretskii
2022-03-23  3:29                             ` Eli Zaretskii
2022-03-23 10:04                               ` João Távora
2022-03-23 13:23                                 ` Eli Zaretskii
2022-03-24 14:54                                   ` João Távora
2022-03-22 12:33             ` Dmitry Gutov
2022-03-22 13:50               ` João Távora

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).