From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.devel
Subject: Re: Edebug corrupting point in buffers.
Date: Wed, 02 Nov 2022 18:57:39 +0200
Message-ID: <83cza59tvg.fsf@gnu.org>
References: <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>
 <Y2JVzZNiWKx/W6KQ@ACM>
 <83mt99a223.fsf@gnu.org> <Y2KYUNWGkcKo9Ei9@ACM>
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="30266"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: emacs-devel@gnu.org
To: Alan Mackenzie <acm@muc.de>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 02 17:59:07 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 1oqH50-0007dY-Kz
	for ged-emacs-devel@m.gmane-mx.org; Wed, 02 Nov 2022 17:59:06 +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 1oqH3o-0005xC-UH; Wed, 02 Nov 2022 12:57:52 -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 <eliz@gnu.org>) id 1oqH3l-0005uo-Pf
 for emacs-devel@gnu.org; Wed, 02 Nov 2022 12:57:49 -0400
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>)
 id 1oqH3l-0001Wi-07; Wed, 02 Nov 2022 12:57:49 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=C9phoS1XIJ5tlDaUo/+9rEr1AJT5dBJbeJOhhvKQah0=; b=O3sHtpjhHysy
 KaoDCuJfjdii5s8mpr906fRnPxstlGFjgJwm/HeW40+4o8li7GB/Svjb9IuaBLTw5dwmw6L7ZnlQ1
 Zny/Dz302krdNEE5P63Wj4ZhZsBrdjPFKeX1phuyhUfOdG/o9Q7+uLezADfsvTJ7Ih+5VomJDVf10
 Wxi7buSJQ06VCSKP16D6I22mJfv9zO9ie4Z6T9xwEXbska7qQbAbLMMURkTVnIThS1QSppJv5g6uP
 XtHf29+JldqiwrIRuFkvcUNefE94bZimQ7L/iWZU68toWraeX0tHv7u7z20CGdaoFXxz0F4qwkWvI
 kE09S3f5YNa2TIV3GwgEAg==;
Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>)
 id 1oqH3k-0006z4-Eu; Wed, 02 Nov 2022 12:57:48 -0400
In-Reply-To: <Y2KYUNWGkcKo9Ei9@ACM> (message from Alan Mackenzie on Wed, 2 Nov
 2022 16:18:24 +0000)
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:299028
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/299028>

> Date: Wed, 2 Nov 2022 16:18:24 +0000
> Cc: emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
> 
> > Yes, I see the problem, but setting edebug-save-windows to nil
> > eliminates it.  So I think we already have a solution for the rare
> > situations where this is an issue.
> 
> It remains a perplexing problem for those who stumble into it.  How about
> instead of patching the code, adding some documentation clarifying the
> problem?
> 
> I would propose the following:

Fine by me, but...

> diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
> index 6a51489d8a..b4f680fe86 100644
> --- a/doc/lispref/edebug.texi
> +++ b/doc/lispref/edebug.texi
> @@ -1019,6 +1019,7 @@ The Outside Context
>  @menu
>  * Checking Whether to Stop::    When Edebug decides what to do.
>  * Edebug Display Update::       When Edebug updates the display.
> +* Edebug Buffer Points::        When @code{point} gets corrupted.
>  * Edebug Recursive Edit::       When Edebug stops execution.
>  @end menu

...please document this in the same place where the variables we
discussed are described.  It is not a good idea from the didactic POV
to have this described separately.

> +This can be a problem when your program itself sets point in a buffer,
> +intending later to use that value of point.  For example, suppose you
> +have buffer B displayed in your selected frame, and you step through
> +the following Lisp fragment:
> +
> +@example
> +(set-buffer A)
> +(set-buffer B)
> +(goto-char (point-max))
> +(insert "foo")
> +(set-buffer A)
> +(set-buffer B)
> +(insert "bar")
> +@end example

I very much doubt that showing this example will help.  It just
muddies the water, b y forcing users to try to understand what the
example does, which is completely irrelevant to what we want to
convey.

Just say that if point gets reset in non-selected windows during
Edebug stepping, users should try customizing that variable.