commit/XEmacs: kehoea: If the position of a window's cached point is deleted, use buffer point instead

[email protected]
Newsgroups gmane.emacs.xemacs.patches
Message-ID <[email protected]>
1 new commit in XEmacs:

https://bitbucket.org/xemacs/xemacs/commits/a1808d52a34a/
Changeset:   a1808d52a34a
User:        kehoea
Date:        2014-06-17 21:55:45
Summary:     If the position of a window's cached point is deleted, use buffer point instead

src/ChangeLog addition:

2014-06-17  Aidan Kehoe  <[email protected]>

	* extents.h:
	* window.c:
	* window.c (unshow_buffer):
	* window.c (Fset_window_buffer):
	Use extents, rather than markers, for the window buffer point
	cache, so that when the text containing that window buffer point
	is deleted, the window display code uses the buffer's actual point
	instead of the position that the marker had been moved to.
	Fixes Michael Heinrich's problem of
	http://mid.gmane.org/[email protected] ,
	introduced by Ben's patch of
	https://bitbucket.org/xemacs/xemacs/commits/047d37eb70d70f43803 .
Affected #:  3 files

diff -r acf1c26e3019f3e8171b591c5b9e120f87187012 -r a1808d52a34a15175e99534534b4a3668135bbda src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
+2014-06-17  Aidan Kehoe  <[email protected]>
+
+	* extents.h:
+	* window.c:
+	* window.c (unshow_buffer):
+	* window.c (Fset_window_buffer):
+	Use extents, rather than markers, for the window buffer point
+	cache, so that when the text containing that window buffer point
+	is deleted, the window display code uses the buffer's actual point
+	instead of the position that the marker had been moved to.
+	Fixes Michael Heinrich's problem of
+	http://mid.gmane.org/[email protected] ,
+	introduced by Ben's patch of
+	https://bitbucket.org/xemacs/xemacs/commits/047d37eb70d70f43803 . 
+
 2014-05-08  Jerry James  <[email protected]>
 
 	* print.c (struct debug_bindings): Add print_circle field.

diff -r acf1c26e3019f3e8171b591c5b9e120f87187012 -r a1808d52a34a15175e99534534b4a3668135bbda src/extents.h
--- a/src/extents.h
+++ b/src/extents.h
@@ -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 acf1c26e3019f3e8171b591c5b9e120f87187012 -r a1808d52a34a15175e99534534b4a3668135bbda src/window.c
--- a/src/window.c
+++ b/src/window.c
@@ -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

Repository URL: https://bitbucket.org/xemacs/xemacs/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.