GNU bug report logs - #53398
29.0.50; narrow-to-region induces buffer recentering

Previous Next

Package: emacs;

Reported by: Jose A Ortega Ruiz <jao <at> gnu.org>

Date: Thu, 20 Jan 2022 21:00:02 UTC

Severity: normal

Tags: moreinfo, wontfix

Found in version 29.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 53398 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jose A Ortega Ruiz <jao <at> gnu.org>
Cc: 53398 <at> debbugs.gnu.org
Subject: Re: bug#53398: 29.0.50; narrow-to-region induces buffer recentering
Date: Fri, 21 Jan 2022 09:07:52 +0200
> From: Jose A Ortega Ruiz <jao <at> gnu.org>
> Date: Thu, 20 Jan 2022 20:59:25 +0000
> 
>        (defun message-kill-to-signature (&optional arg)
>           "Kill all text up to the signature.
>         If a numeric argument or prefix arg is given, leave that number
>         of lines before the signature intact."
>           (interactive "P" message-mode)
>           (save-excursion
>             (save-restriction
>               (let ((point (point)))
>         	(narrow-to-region point (point-max))  ;;;;;; <------------------------
>         	(message-goto-signature)
>         	(unless (eobp)
>         	  (if (and arg (numberp arg))
>         	      (forward-line (- -1 arg))
>         	    (end-of-line -1)))
>         	(unless (= point (point))
>         	  (kill-region point (point))
>         	  (unless (bolp)
>         	    (insert "\n")))))))
> 
> so i am (wild) guessing that the spurious recenter might be related with
> save-restriction workings in combination with narrow, but i don't really
> know what i'm talking about :)

Any chance of having a reproduction recipe that is simpler and
preferably doesn't include message.el at all?  IOW, if your guess is
correct, and the problem is inside narrow-to-region, we shouldn't need
this elaborate setup to show the issue, right?  Can you show such a
recipe?

Also, you say "previous behavior was", but when did you see that
previous behavior and in what Emacs version?

> The only variable related to scroll i can see changed from its default
> value in my config is scroll-preserve-screen-position, which i set to
> 'always, but changing its value doesn't affect the behaviour above in
> any way.

So you are saying that this recentering doesn't happen in "emacs -Q",
even if you do invoke that Message mode command?  If so, please try
to find which of your customizations do affect it.




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

Previous Next


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