Subject: bug#15957: 24.3.50; Follow mode scrolling broken on Emacs trunk

From: Anders Lindgren <[email-masked]>
Date: Tue, 26 Nov 2013 12:01:13 +0100

Hi Dmitry!

The problem only occurs under certain circumstances. `window-end' must
called from a post-command hook and the command that started it must be
bound to a key (not using M-x). Also, sometimes it seems to work correctly,
sometimes not, like every second time. (Take "must" with a grain of salt,
it might be possible to trigger the bug under other circumstances as well.)

I have attached a piece of lisp code which basically is the follow-mode
code plus log commands, so that you clearly can see the return value of
different functions, including the call to `windows-end'. I'm sure it would
be possible to cut down the code to a minimal, now when we know that it's
`window-end' that returns the incorrect value. (The logs I referred to in
the previous mails were generated by this package.) I'm not familiar with
the bug tracking system, but feel free to add this code to it.

In case you are not familiar with follow-mode, it is a package that creates
the illusion that you have one large window spread out over several
side-by-side windows, you can move between the windows using the normal
cursor keys, and when you scroll one window, the others follow (hence the
name "Follow mode"). Technically, this is accomplished by a using a
post-command hook that performs all the repositioning, plus a handful of
new function performing operations that didn't exist before (like scrolling
X pages, where X equal the number of windows the buffer is shown in).

Do you think that you have everything that you need to find and fix the
bug, or is there anything else that I can help you with?

Sincerely,
    Anders Lindgren

On Tue, Nov 26, 2013 at 7:33 AM, Dmitry Antipov <[email-masked]> wrote:

> On 11/25/2013 08:42 PM, martin rudalics wrote:
>
>> Forwarding Anders Lindgren's mail to [email-masked] and Dmitry
>> Antipov.
>>
>>  Hi!
>>>
>>> I believe that I have found the problem. In `follow-calc-win-end', there
>>> is
>>> a call to `(window-end win t)'. The `t' means "compute the up-to-date
>>> position
>>> if it isn't already recorded." The return value from this function is
>>> clearly incorrect. The fact that the wrong window is selected is simply a
>>> consequence of this.
>>>
>>> In the older Emacs (up to bzr revision 113752), this seems to work
>>> correctly. However, in the newer (starting from bzt revision 113753) this
>>> is broken.
>>>
>>
> Hm...I just add debug printf() at the end of Fwindow_end, and see an
> identical output for 24.3 and r115239 for this simple example:
>
> ./src/emacs -Q -font 6x10 -geometry 200x65
> C-h t
> M-x follow-delete-other-windows-and-split
> C-c . C-v
>
> So if someone has a elisp code that clearly shows that window-end is
> broken,
> please attach it to this bug at least.
>
> Dmitry
>
>
>