GNU bug report logs -
#13248
24.2.50; select-window moves point (in comint-postoutput-scroll-to-bottom)
Previous Next
Reported by: Vitalie Spinu <spinuvit <at> gmail.com>
Date: Fri, 21 Dec 2012 13:16:02 UTC
Severity: normal
Found in version 24.2.50
Done: martin rudalics <rudalics <at> gmx.at>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Here is what I found during my investigation. It happens with
> (select-window w) in the `comint-postoutput-scroll-to-bottom'
> (reproduced below). I was monitoring the value of the (point) just
> before and after it, and it looks like this:
>
> before (point):9943
> after (point):8619
>
> So the point is clearly moved in select-window. Moreover the (point)
> equals (window-end) just before select-window is called, so it is
> visible. Consequently, the following (comint-adjust-point selected) is
> completely screwed because it relies on point *not* being moved!
>
> Here is a relevant piece of `comint-postoutput-scroll-to-bottom'
>
>
> ╭──────── #2124 ─ /home/vitoshka/TVC/emacs/lisp/comint.el ──
> │ (dolist (w (get-buffer-window-list current nil t))
> │ (select-window w)
> │ (unwind-protect
> │ (progn
> │ (comint-adjust-point selected)
> │ ;; Optionally scroll to the bottom of the window.
> │ (and comint-scroll-show-maximum-output
> │ (eobp)
> │ (recenter (- -1 scroll-margin))))
> │ (select-window selected))))))
> │ (set-buffer current))))
> ╰──────── #2134 ─
>
>
> The variable `comint-scroll-show-maximum-output' is the default t, this
> is why comint runs `comint-postoutput-scroll-to-bottom' in its
> `comint-output-filter-functions'.
>
> I can propose a patch for commit to reset the point, but it looks like
> there is something much more fundamental going on in here.
select_window (in window.c) has the following comment
/* Go to the point recorded in the window.
This is important when the buffer is in more
than one window. It also matters when
redisplay_window has altered point after scrolling,
because it makes the change only in the window. */
Is it this behavior that bothers you?
IIUC what you want in `comint-postoutput-scroll-to-bottom' is to
`set-window-point' of the respective window. If you really want to move
`point' in a buffer _and_ show the effect in a window, do it with that
window selected.
martin
This bug report was last modified 12 years and 145 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.