[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13248: 24.2.50; select-window moves point (in comint-postoutput-scro
From: |
martin rudalics |
Subject: |
bug#13248: 24.2.50; select-window moves point (in comint-postoutput-scroll-to-bottom) |
Date: |
Fri, 21 Dec 2012 15:25:07 +0100 |
> 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