From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#12170: save-excursion fails boundary case with recenter Date: Fri, 10 Aug 2012 22:01:51 +0300 Message-ID: <83393uefkw.fsf@gnu.org> References: <000001cd7696$b0e93d60$12bbb820$@com> <5024D593.7080305@gmx.at> <003601cd76fd$b21cd590$165680b0$@com> <50251EED.3010804@gmx.at> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1344625398 25140 80.91.229.3 (10 Aug 2012 19:03:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Aug 2012 19:03:18 +0000 (UTC) Cc: 12170@debbugs.gnu.org, wbrodie@panix.com To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 10 21:03:17 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SzuUN-0004tw-Sp for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Aug 2012 21:03:16 +0200 Original-Received: from localhost ([::1]:32797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzuUN-00085Q-11 for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Aug 2012 15:03:15 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzuUJ-00083h-PJ for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 15:03:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzuTu-0004nC-4g for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 15:03:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzuTu-0004n8-1B for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 15:02:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Szubu-0004zo-Fg for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 15:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Aug 2012 19:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12170 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12170-submit@debbugs.gnu.org id=B12170.134462580419102 (code B ref 12170); Fri, 10 Aug 2012 19:11:02 +0000 Original-Received: (at 12170) by debbugs.gnu.org; 10 Aug 2012 19:10:04 +0000 Original-Received: from localhost ([127.0.0.1]:47384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Szuax-0004y2-P1 for submit@debbugs.gnu.org; Fri, 10 Aug 2012 15:10:04 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:43424) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Szuav-0004xa-A0 for 12170@debbugs.gnu.org; Fri, 10 Aug 2012 15:10:01 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0M8J00700ZDC1R00@a-mtaout20.012.net.il> for 12170@debbugs.gnu.org; Fri, 10 Aug 2012 22:01:44 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M8J00632ZIVUY70@a-mtaout20.012.net.il>; Fri, 10 Aug 2012 22:01:44 +0300 (IDT) In-reply-to: <50251EED.3010804@gmx.at> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:63018 Archived-At: > Date: Fri, 10 Aug 2012 16:47:09 +0200 > From: martin rudalics > Cc: 12170@debbugs.gnu.org > > (defun f (n) > (save-this-window-excursion (forward-line (- n)) (recenter 0))) > > (let ((buffer (switch-to-buffer "foo")) > (height (1- (window-height (get-buffer-window "foo"))))) > (insert-char 10 (* height 2)) > (let ((pt (point))) > (f height) > (redisplay) > (message "height %s old %s new %s" height pt (point))))) > > so I'd suspect the culprit somewhere in redisplay_window's code By saying "culprit" you mean you think this is a bug? I think Stefan explained why it isn't. > if (w->optional_new_start > > w->optional_new_start is 1 from `recenter' > > && CHARPOS (startp) >= BEGV > && CHARPOS (startp) <= ZV) > { > w->optional_new_start = 0; > start_display (&it, w, startp); > move_it_to (&it, PT, 0, it.last_visible_y, -1, > MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); > if (IT_CHARPOS (it) == PT) > w->force_start = 1; > /* IT may overshoot PT if text at PT is invisible. */ > else if (IT_CHARPOS (it) > PT && CHARPOS (startp) <= PT) > w->force_start = 1; > > w->force_start 1 will cause redisplay to honor the start position set up > by `recenter' Only if point will be visible when window is displayed starting at startp. > But I don't have the slightest idea how calling > > (set-window-start (selected-window) ,start t) > > would remedy this. Eli will soon teach us a lesson here. Not sure there's a lesson here to learn, but set-window-start sets the w->force_start flag unconditionally, so it will hold even if point is not in the displayed portion of the window (i.e., point will move). Does that explain things?