emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Edebug corrupting point in buffers; we need buffer-point and set-buffer-


From: Alan Mackenzie
Subject: Edebug corrupting point in buffers; we need buffer-point and set-buffer-point, perhaps.
Date: Mon, 31 Oct 2022 11:43:15 +0000

Hello, Emacs.

A few weeks ago, I was attempting to edebug a program which itself
scanned through a buffer B.  That buffer was also displayed in a window
(or possibly two windows).  Each time the program went into edebug, the
point in B got corrupted.

Setting edebug-save-displayed-buffer-points didn't help.

I now understand what was going wrong.  Without
edebug-save-displayed-buffer-points, B's point got set to a window point
from a random window displaying B, caused by a set-window-configuration
call from edebug.

With edebug-save-displayed-buffer-points set, the function
edebug-get-displayed-buffer points was recording window-points for each
displayed window, but after the recursive edit was writing these
window-points back into the buffer points.  This is surely a bug.  At the
least, there is a race condition if two windows display the same buffer.

In neither of the above scenarios does edebug do anything to restore the
buffer points after the recursive edit.  This seems to be a bad thing.

I propose that edebug should get an option to preserve buffer points,
alongside the existing options which preserve window points.

One downside of this would be the runtime involved in the set-buffer
calls needed to call `point' and `goto-char'.  This could make edebug
quite sluggish.  So, why don't we introduce new functions buffer-point
and set-buffer-point?  These would enable edebug to record and restore
these points economically.  Why don't these functions exist already?

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]