From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#33532: 26.1; set-window-configuration does not restore display start Date: Wed, 28 Nov 2018 08:41:57 +0200 Message-ID: <83o9a9g0ui.fsf@gnu.org> References: <87efb62mt2.fsf@metalevel.at> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1543387211 9138 195.159.176.226 (28 Nov 2018 06:40:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Nov 2018 06:40:11 +0000 (UTC) Cc: 33532@debbugs.gnu.org To: Markus Triska Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 28 07:40:07 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRtW2-0002Gk-19 for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Nov 2018 07:40:06 +0100 Original-Received: from localhost ([::1]:46248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRtY8-00020d-J7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Nov 2018 01:42:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRtXw-00020G-Fh for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2018 01:42:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRtXu-0006dh-Ke for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2018 01:42:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48499) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRtXu-0006da-Gz for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2018 01:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gRtXu-00073Y-Bv for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2018 01:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Nov 2018 06:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33532 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33532-submit@debbugs.gnu.org id=B33532.154338732127117 (code B ref 33532); Wed, 28 Nov 2018 06:42:02 +0000 Original-Received: (at 33532) by debbugs.gnu.org; 28 Nov 2018 06:42:01 +0000 Original-Received: from localhost ([127.0.0.1]:52757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRtXs-00073I-WC for submit@debbugs.gnu.org; Wed, 28 Nov 2018 01:42:01 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRtXr-000735-5g for 33532@debbugs.gnu.org; Wed, 28 Nov 2018 01:41:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRtXg-0006Yw-UI for 33532@debbugs.gnu.org; Wed, 28 Nov 2018 01:41:53 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRtXg-0006Ys-RN; Wed, 28 Nov 2018 01:41:48 -0500 Original-Received: from [176.228.60.248] (port=1714 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gRtXg-000548-BK; Wed, 28 Nov 2018 01:41:48 -0500 In-reply-to: <87efb62mt2.fsf@metalevel.at> (message from Markus Triska on Tue, 27 Nov 2018 23:11:21 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:152844 Archived-At: > From: Markus Triska > Date: Tue, 27 Nov 2018 23:11:21 +0100 > > (let ((buf (get-buffer-create "buf"))) > (switch-to-buffer buf) > (erase-buffer) > (dotimes (x 10) > (insert (format "x is %s\n" x))) > (recenter 3) > (sit-for 1) > (let ((conf (current-window-configuration)) > (ws (window-start)) > (str (with-current-buffer buf (buffer-string)))) > (with-current-buffer buf > (erase-buffer) > (insert str)) > (set-window-configuration conf) > (sit-for 1) > (message "window-start: %s vs. %s" ws (window-start)))) > > This shows that after set-window-configuration, even though the buffer > content is the same as at the time the configuration was obtained, the > value of (window-start) differs from before: After the window > configuration is set, (window-start) is 1. I expect it to be 50 (i.e., > the value at the time the configuration was obtained), because the > documentation of current-window-configuration states: The window-start point is a marker, and is saved as such. Your code replaces the entire text of the buffer with something new, so all the markers are invalidated. How important is the use case of replacing buffer text with identical text? Because replacing with a different text will make preserving window-start position based on its numerical value not really a sensible thing, would it? It could even be impossible, e.g. if the same position happens to be in the middle of a sequence of composed characters.