GNU bug report logs - #23098
25.0.92; (recenter -1) can leave point in the middle of the window

Previous Next

Package: emacs;

Reported by: Jorgen Schaefer <jorgen.schaefer <at> gmail.com>

Date: Wed, 23 Mar 2016 18:41:01 UTC

Severity: normal

Found in version 25.0.92

Full log


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

From: Jorgen Schäfer <jorgen.schaefer <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 23098 <at> debbugs.gnu.org
Subject: Re: bug#23098: 25.0.92; (recenter -1) can leave point in the middle
 of the window
Date: Thu, 24 Mar 2016 16:27:53 +0000
[Message part 1 (text/plain, inline)]
> If you do the above, do you still get the cursor recentered in the
> window?

Hm. That seems to work. I was using let-binding around recenter, which does
not work. Even resetting scroll-conservatively after the call to recenter
will exhibit the bug again. So setting scroll-conservatively is a possible
workaround, although it means that *all* scrolling will be affected by
scroll-conservatively. E.g. scrolling through the backlog of a M-x shell
session would be affected, even though it just should affect the scrolling
when the last line of the buffer is visible at all.

On Thu, Mar 24, 2016 at 4:48 PM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Jorgen Schäfer <jorgen.schaefer <at> gmail.com>
> > Date: Thu, 24 Mar 2016 08:12:08 +0000
> > Cc: 23098 <at> debbugs.gnu.org
> >
> > > If you set scroll-conservatively to a value larger than 100, don't you
> > > get point as low as possible?
> >
> > No.
>
> That's strange.
>
> Let me be absolutely sure we are trying the same thing.  What I did is
> the following:
>
>   . emacs -Q
>   . paste the following into *scratch*, which is exactly the code you
>     posted with a single line added:
>
>     (require 'cl)
>     (let* ((b (get-buffer-create "*Bug Repro*"))
>            (w (selected-window))
>            (l (window-height w))
>            o)
>       (set-window-buffer w b)
>       (select-window w)
>       (set-buffer b)
>       (erase-buffer)
>       (setq scroll-conservatively 101) ;; <<<<< this line was added
>       (cl-dotimes (i (* l 2))
>                   (insert "foo\n"))
>       (goto-char (point-min))
>       (forward-line (+ l 2))
>       (setq o (make-overlay (point) (point)))
>       (overlay-put o 'after-string "\n")
>       (goto-char (point-max))
>       (recenter -1))
>
>   . M-x eval-region RET
>
> After this, buffer "*Bug Repro*" pops up, with point at EOB positioned
> on the 2nd line from bottom of the window (instead of the last line).
>
> If you do the above, do you still get the cursor recentered in the
> window?  If so, I will try to play with display defaults in order to
> reproduce what you see.
>
> Thanks.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 9 years and 88 days ago.

Previous Next


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