X-Loop: help-debbugs@HIDDEN Subject: bug#34038: 26.1; set-window-start sometimes fails to set window start Resent-From: Markus Triska <triska@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 10 Jan 2019 19:58:02 +0000 Resent-Message-ID: <handler.34038.B.154715027129099 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 34038 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 34038 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.154715027129099 (code B ref -1); Thu, 10 Jan 2019 19:58:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Jan 2019 19:57:51 +0000 Received: from localhost ([127.0.0.1]:54267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ghgSd-0007ZH-0E for submit <at> debbugs.gnu.org; Thu, 10 Jan 2019 14:57:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <triska@HIDDEN>) id 1ghgSb-0007Z4-H2 for submit <at> debbugs.gnu.org; Thu, 10 Jan 2019 14:57:49 -0500 Received: from lists.gnu.org ([209.51.188.17]:41664) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1ghgSV-00062E-7F for submit <at> debbugs.gnu.org; Thu, 10 Jan 2019 14:57:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1ghgSU-0006FG-AO for bug-gnu-emacs@HIDDEN; Thu, 10 Jan 2019 14:57:43 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1ghgSS-00060P-HU for bug-gnu-emacs@HIDDEN; Thu, 10 Jan 2019 14:57:41 -0500 Received: from metalevel.at ([78.46.218.83]:56006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1ghgSP-0005wf-M5 for bug-gnu-emacs@HIDDEN; Thu, 10 Jan 2019 14:57:38 -0500 Received: from mts-Mac-mini.localdomain (localhost.localdomain [127.0.0.1]) by metalevel.at (Postfix) with ESMTP id DED06A00D7 for <bug-gnu-emacs@HIDDEN>; Thu, 10 Jan 2019 20:57:28 +0100 (CET) Received: by mts-Mac-mini.local (Postfix, from userid 501) id 882492E8D94; Thu, 10 Jan 2019 20:57:28 +0100 (CET) From: Markus Triska <triska@HIDDEN> Date: Thu, 10 Jan 2019 20:57:28 +0100 Message-ID: <m2ftu05lqv.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 78.46.218.83 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) To reproduce this issue, please start Emacs with "$ emacs -Q" and paste at the end of the *scratch* buffer the following form: (progn (goto-char (point-max)) (insert "\n") (dotimes (x (window-height)) (insert (format "%s\n" x))) (redisplay) (let ((b (buffer-string)) (p (point))) (set-window-start nil p t) (read-key "Please press a key to continue.") (erase-buffer) (insert b) (set-window-start nil p t))) Then, put point at the end of the form, and evaluate it with C-x C-e. Conceptually, this program: 1) inserts several (i.e, window-height) lines into the buffer 2) sets window point to p, which is point after (1) 3) WAITS FOR A KEY PRESS (please press a key at this point) 4) erases and restores the buffer contents 5) sets window point to p, the same point as in (2) However, in many invocations (please try it repeatedly if necessary), the visible portion of the buffer unexpectedly differs between (3) and after the whole procedure. In other words, when Emacs waits for a key press, a different portion of the buffer is visible compared to after you press a key, even though window-start is set to the same position in both cases. Is there a way to reliably set the window-start in such situations? Thank you very much! Markus In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2018-11-18 built on debian Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea Windowing system distributor 'The X.Org Foundation', version 11.0.11902000 System Description: Debian GNU/Linux 9.6 (stretch)
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Markus Triska <triska@HIDDEN> Subject: bug#34038: Acknowledgement (26.1; set-window-start sometimes fails to set window start) Message-ID: <handler.34038.B.154715027129099.ack <at> debbugs.gnu.org> References: <m2ftu05lqv.fsf@HIDDEN> X-Gnu-PR-Message: ack 34038 X-Gnu-PR-Package: emacs Reply-To: 34038 <at> debbugs.gnu.org Date: Thu, 10 Jan 2019 19:58:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 34038 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 34038: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D34038 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#34038: 26.1; set-window-start sometimes fails to set window start Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 11 Jan 2019 07:05:02 +0000 Resent-Message-ID: <handler.34038.B34038.154719024911236 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 34038 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Markus Triska <triska@HIDDEN> Cc: 34038 <at> debbugs.gnu.org Received: via spool by 34038-submit <at> debbugs.gnu.org id=B34038.154719024911236 (code B ref 34038); Fri, 11 Jan 2019 07:05:02 +0000 Received: (at 34038) by debbugs.gnu.org; 11 Jan 2019 07:04:09 +0000 Received: from localhost ([127.0.0.1]:54449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ghqrR-0002v9-1F for submit <at> debbugs.gnu.org; Fri, 11 Jan 2019 02:04:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1ghqrM-0002ud-Jm for 34038 <at> debbugs.gnu.org; Fri, 11 Jan 2019 02:04:07 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55781) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>) id 1ghqrG-0008Qi-Sj; Fri, 11 Jan 2019 02:03:58 -0500 Received: from [176.228.60.248] (port=2860 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from <eliz@HIDDEN>) id 1ghqrG-00041q-Bk; Fri, 11 Jan 2019 02:03:58 -0500 Date: Fri, 11 Jan 2019 09:03:55 +0200 Message-Id: <83sgxzhe04.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-reply-to: <m2ftu05lqv.fsf@HIDDEN> (message from Markus Triska on Thu, 10 Jan 2019 20:57:28 +0100) References: <m2ftu05lqv.fsf@HIDDEN> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) > From: Markus Triska <triska@HIDDEN> > Date: Thu, 10 Jan 2019 20:57:28 +0100 > > 1) inserts several (i.e, window-height) lines into the buffer > 2) sets window point to p, which is point after (1) > 3) WAITS FOR A KEY PRESS (please press a key at this point) > 4) erases and restores the buffer contents > 5) sets window point to p, the same point as in (2) > > However, in many invocations (please try it repeatedly if necessary), > the visible portion of the buffer unexpectedly differs between (3) and > after the whole procedure. > > In other words, when Emacs waits for a key press, a different portion of > the buffer is visible compared to after you press a key, even though > window-start is set to the same position in both cases. > > Is there a way to reliably set the window-start in such situations? I think this happens because you call set-window-start with last argument non-nil. Doing that tells the display engine that the window-start point is just a suggestion, not a hard requirement.
X-Loop: help-debbugs@HIDDEN Subject: bug#34038: 26.1; set-window-start sometimes fails to set window start Resent-From: Markus Triska <triska@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 11 Jan 2019 12:21:02 +0000 Resent-Message-ID: <handler.34038.B34038.154720923915097 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 34038 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii <eliz@HIDDEN> Cc: 34038 <at> debbugs.gnu.org Received: via spool by 34038-submit <at> debbugs.gnu.org id=B34038.154720923915097 (code B ref 34038); Fri, 11 Jan 2019 12:21:02 +0000 Received: (at 34038) by debbugs.gnu.org; 11 Jan 2019 12:20:39 +0000 Received: from localhost ([127.0.0.1]:54703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ghvnh-0003vQ-R6 for submit <at> debbugs.gnu.org; Fri, 11 Jan 2019 07:20:38 -0500 Received: from metalevel.at ([78.46.218.83]:59572) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <triska@HIDDEN>) id 1ghvnf-0003vH-R4 for 34038 <at> debbugs.gnu.org; Fri, 11 Jan 2019 07:20:36 -0500 Received: by metalevel.at (Postfix, from userid 1000) id 58A2AA0227; Fri, 11 Jan 2019 13:20:33 +0100 (CET) From: Markus Triska <triska@HIDDEN> References: <m2ftu05lqv.fsf@HIDDEN> <83sgxzhe04.fsf@HIDDEN> Date: Fri, 11 Jan 2019 13:20:33 +0100 In-Reply-To: <83sgxzhe04.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 11 Jan 2019 09:03:55 +0200") Message-ID: <87ef9je67i.fsf@HIDDEN> User-Agent: Emacs/24.5 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: > I think this happens because you call set-window-start with last > argument non-nil. Doing that tells the display engine that the > window-start point is just a suggestion, not a hard requirement. In the documentation of set-window-start, the last argument is described as: Optional third arg NOFORCE non-nil inhibits next redisplay from overriding motion of point in order to display at this exact start. From this text, this seems to be precisely what I need: I want to retain point at this exact place, and I only want to change the window start, not the point. In my use case, if I set this argument to "nil", then I get unexpected point motion. Is there a way to reliably set window point while at the same time preventing motion of point? I tried adding (redisplay) at strategic places in my code, and this seems to work somewhat better then, though at the cost of causing display flickering. Thank you and all the best! Markus
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.