From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Alan Mackenzie <acm@muc.de>
Newsgroups: gmane.emacs.devel
Subject: Re: Edebug corrupting point in buffers.
Date: Wed, 2 Nov 2022 11:34:37 +0000
Message-ID: <Y2JVzZNiWKx/W6KQ@ACM>
References: <Y2A9NINYSfByTztE@ACM> <83wn8fcgvd.fsf@gnu.org>
 <Y2EFztE/GgFF0P3x@ACM> <83iljydh7e.fsf@gnu.org>
 <Y2EiK32B9lxLSFms@ACM> <838rkud9d5.fsf@gnu.org>
 <Y2FSHvmj2H8a5AS6@ACM> <83v8nybnuk.fsf@gnu.org>
 <Y2FWSoSCQnnY9en1@ACM> <83pme6bls8.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="33037"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: emacs-devel@gnu.org
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 02 12:36:04 2022
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>)
	id 1oqC2O-0008KL-15
	for ged-emacs-devel@m.gmane-mx.org; Wed, 02 Nov 2022 12:36:04 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-devel-bounces@gnu.org>)
	id 1oqC1S-0001vU-81; Wed, 02 Nov 2022 07:35:06 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acm@muc.de>) id 1oqC19-0001sV-Bh
 for emacs-devel@gnu.org; Wed, 02 Nov 2022 07:34:47 -0400
Original-Received: from mx3.muc.de ([193.149.48.5])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acm@muc.de>) id 1oqC17-0001Vy-8E
 for emacs-devel@gnu.org; Wed, 02 Nov 2022 07:34:47 -0400
Original-Received: (qmail 28673 invoked by uid 3782); 2 Nov 2022 12:34:39 +0100
Original-Received: from acm.muc.de (p4fe15d2a.dip0.t-ipconnect.de [79.225.93.42])
 (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
 Wed, 02 Nov 2022 12:34:39 +0100
Original-Received: (qmail 4637 invoked by uid 1000); 2 Nov 2022 11:34:37 -0000
Content-Disposition: inline
In-Reply-To: <83pme6bls8.fsf@gnu.org>
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
X-Primary-Address: acm@muc.de
Received-SPF: pass client-ip=193.149.48.5; envelope-from=acm@muc.de;
 helo=mx3.muc.de
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=subscribe>
Original-Sender: "Emacs-devel" <emacs-devel-bounces@gnu.org>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.devel:299002
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/299002>

Hello, Eli.

On Tue, Nov 01, 2022 at 19:57:11 +0200, Eli Zaretskii wrote:
> > Date: Tue, 1 Nov 2022 17:24:26 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> This now gets me back to the inability to reproduce the problem with
> your recipe.  If that depends on edebug-save-windows, not on
> edebug-save-displayed-buffer-points, and since edebug-save-windows is
> t by default, why wasn't I able to reproduce the problem?

I've stumbled across a possible reason why you couldn't reproduce the
bug.  There was a crucial step missing from the recipe.  I've inserted
that step into the previous recipe as (iv)a:

With test-edebug.el being
#########################################################################
(defun test-edebug ()
  (let ((A "*scratch*") (B "emacs.README"))
    (set-buffer A)
    (set-buffer B)
    (goto-char (point-max))
    (insert "(2022-11-01)\n")
    ;; B's buffer-point is at point-max.

    (set-buffer A)
    (set-buffer B)
    ;; B's buffer-point is no longer at point-max.
    (insert "(2022-11-01)a\n")))
#########################################################################
,
(i) Emacs -Q.
(ii) On a single frame, arrange buffers *scratch*, test-edebug.el, and
  some other substantial buffer, that I call emacs.README.
(iii) Put point in emacs.README somewhere other than point-max.
(iv) Instrument test-edebug for edebug with C-u C-M-x.
(iv)a Put point into window *scratch*.
(v) M-: (test-edebug).
(vi) Step through test-edebug using the space key.
(vii) Note that the second text insertion happens where point was in the
  window, not at point-max.  This is the bug.

There are bits of code that don't restore buffer-point in the current
buffer.  One of these is probably the explanation why the bug doesn't
trigger with point starting in emacs.README.

-- 
Alan Mackenzie (Nuremberg, Germany).