Ar an ceathrú lá déag de mí Meitheamh, scríobh Aidan Kehoe:
Ar an triú lá déag de mí Meitheamh, scríobh Aidan Kehoe:
> There’s no obvious quick solution to the bug. A longer-term solution
> is to implement a replacement primitive in insdel.c, as GNU have, and
> use it in dired. This would have advantages for the coding-system code
> too.
I was wrong, a quick solution is implement the cache using zero-length
detachable extents, which will disappear when the relevant text is deleted.
This will cause the cache code to use the primary buffer point instead, in
that event. No patch from me just yet.
Here’s one, though. I’d appreciate if you could test it.
diff -r acf1c26e3019 src/extents.h
--- a/src/extents.h Thu May 15 12:25:25 2014 -0600
+++ b/src/extents.h Mon Jun 16 18:31:09 2014 +0100
@@ -132,6 +132,7 @@
EXFUN (Fextent_property, 3);
EXFUN (Fput_text_property, 5);
+EXFUN (Fextent_detached_p, 1);
EXFUN (Fdetach_extent, 1);
EXFUN (Fextent_end_position, 1);
EXFUN (Fextent_object, 1);
diff -r acf1c26e3019 src/window.c
--- a/src/window.c Thu May 15 12:25:25 2014 -0600
+++ b/src/window.c Mon Jun 16 18:31:09 2014 +0100
@@ -41,6 +41,7 @@
#include "commands.h"
#include "device-impl.h"
#include "elhash.h"
+#include "extents.h"
#include "faces.h"
#include "frame-impl.h"
#include "glyphs.h"
@@ -2047,17 +2048,29 @@
BUF_ZV (b)));
{
- Lisp_Object marker = Fgethash (buf, w->saved_point_cache, Qnil);
+ Lisp_Object marker;
+ Lisp_Object saved_point = Fgethash (buf, w->saved_point_cache, Qnil);
int selected = EQ (wrap_window (w), Fselected_window (Qnil));
- if (NILP (marker))
+ if (NILP (saved_point))
{
- marker = Fmake_marker ();
- Fputhash (buf, marker, w->saved_point_cache);
+ saved_point = Fmake_extent (Qnil, Qnil, buf);
+ Fset_extent_property (saved_point, Qstart_open, Qt);
+ Fputhash (buf, saved_point, w->saved_point_cache);
}
- Fset_marker (marker,
- selected ? make_fixnum (BUF_PT (b)) : w->pointm[CURRENT_DISP],
- buf);
+
+ if (selected)
+ {
+ set_extent_endpoints (XEXTENT (saved_point),
+ BYTE_BUF_PT (b), BYTE_BUF_PT (b), buf);
+ }
+ else
+ {
+ set_extent_endpoints (XEXTENT (saved_point),
+ byte_marker_position (w->pointm[CURRENT_DISP]),
+ byte_marker_position (w->pointm[CURRENT_DISP]),
+ buf);
+ }
marker = Fgethash (buf, w->saved_last_window_start_cache, Qnil);
@@ -3710,10 +3723,12 @@
buffer);
#else
{
- Lisp_Object marker = Fgethash (buffer, w->saved_point_cache, Qnil);
+ Lisp_Object saved_point = Fgethash (buffer, w->saved_point_cache, Qnil);
Lisp_Object newpoint =
- !NILP (marker) ? make_fixnum (marker_position (marker)) :
- make_fixnum (BUF_PT (XBUFFER (buffer)));
+ (EXTENTP (saved_point) && !NILP (Fextent_detached_p (saved_point)))
+ ? Fextent_start_position (saved_point)
+: make_fixnum (BUF_PT (XBUFFER (buffer)));
+ Lisp_Object marker;
/* Previously, we had in here set-window-point, which did one of the
following two, but not both. However, that could result in pointm
being in a different buffer from the window's buffer! Probably
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta