GNU bug report logs - #34038
26.1; set-window-start sometimes fails to set window start

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Markus Triska <triska@HIDDEN>; dated Thu, 10 Jan 2019 19:58:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 34038 <at> debbugs.gnu.org:


Received: (at 34038) by debbugs.gnu.org; 11 Jan 2019 12:20:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 11 07:20:39 2019
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>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#34038: 26.1;
 set-window-start sometimes fails to set window start
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-Debbugs-Envelope-To: 34038
Cc: 34038 <at> debbugs.gnu.org
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





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34038; Package emacs. Full text available.

Message received at 34038 <at> debbugs.gnu.org:


Received: (at 34038) by debbugs.gnu.org; 11 Jan 2019 07:04:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 11 02:04:09 2019
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>
To: Markus Triska <triska@HIDDEN>
In-reply-to: <m2ftu05lqv.fsf@HIDDEN> (message from Markus Triska on Thu, 
 10 Jan 2019 20:57:28 +0100)
Subject: Re: bug#34038: 26.1;
 set-window-start sometimes fails to set window start
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-Debbugs-Envelope-To: 34038
Cc: 34038 <at> debbugs.gnu.org
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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34038; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Jan 2019 19:57:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 10 14:57:51 2019
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>
To: bug-gnu-emacs@HIDDEN
Subject: 26.1; set-window-start sometimes fails to set window start
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-Debbugs-Envelope-To: submit
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)




Acknowledgement sent to Markus Triska <triska@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#34038; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 11 Jan 2019 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.