GNU bug report logs - #54488
29.0.50; move-to-column/overlay-related regression in latest master, perhaps 28?

Previous Next

Package: emacs;

Reported by: João Távora <joaotavora <at> gmail.com>

Date: Mon, 21 Mar 2022 06:54:02 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: 54488 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: bug#54488: 29.0.50; move-to-column/overlay-related regression in latest master, perhaps 28?
Date: Tue, 22 Mar 2022 17:22:15 +0200
> From: João Távora <joaotavora <at> gmail.com>
> Cc: dgutov <at> yandex.ru,  54488 <at> 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.

> (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))
>                                   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?




This bug report was last modified 3 years and 85 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.