all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Vitalie Spinu <spinuvit@gmail.com>
Cc: 13248@debbugs.gnu.org
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	[thread overview]
Message-ID: <50D47143.40702@gmx.at> (raw)
In-Reply-To: <87a9t7bl8o.fsf@gmail.com>

 > 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






  reply	other threads:[~2012-12-21 14:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21 13:14 bug#13248: 24.2.50; select-window moves point (in comint-postoutput-scroll-to-bottom) Vitalie Spinu
2012-12-21 14:25 ` martin rudalics [this message]
2012-12-21 14:38   ` Vitalie Spinu
2012-12-21 14:48   ` Vitalie Spinu
2012-12-22 10:18     ` martin rudalics
2012-12-25  0:18   ` bug#13248: [PATCH] " Vitalie Spinu
2012-12-25 18:09     ` martin rudalics
2012-12-25 22:28       ` Vitalie Spinu
2012-12-27  7:36         ` martin rudalics
2013-01-02  8:03           ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50D47143.40702@gmx.at \
    --to=rudalics@gmx.at \
    --cc=13248@debbugs.gnu.org \
    --cc=spinuvit@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.