emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r99817: * xdisp.c (redisplay_windo


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r99817: * xdisp.c (redisplay_window): After redisplay, check if point is
Date: Thu, 27 May 2010 11:42:50 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99817
committer: Chong Yidong <address@hidden>
branch nick: emacs-23
timestamp: Thu 2010-05-27 11:42:50 -0400
message:
  * xdisp.c (redisplay_window): After redisplay, check if point is
  still valid before setting it (Bug#6177).
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-05-21 04:06:34 +0000
+++ b/src/ChangeLog     2010-05-27 15:42:50 +0000
@@ -1,3 +1,8 @@
+2010-05-27  Chong Yidong  <address@hidden>
+
+       * xdisp.c (redisplay_window): After redisplay, check if point is
+       still valid before setting it (Bug#6177).
+
 2010-05-20  enami tsugutomo  <address@hidden>
 
        * s/netbsd.h: If terminfo is found, use it in preference to

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2010-04-05 15:46:29 +0000
+++ b/src/xdisp.c       2010-05-27 15:42:50 +0000
@@ -13936,8 +13936,16 @@
         (*FRAME_TERMINAL (f)->redeem_scroll_bar_hook) (w);
     }
 
-  /* Restore current_buffer and value of point in it.  */
-  TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint));
+  /* Restore current_buffer and value of point in it.  The window
+     update may have changed the buffer, so first make sure `opoint'
+     is still valid (Bug#6177).  */
+  if (CHARPOS (opoint) < BEGV)
+    TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
+  else if (CHARPOS (opoint) > ZV)
+    TEMP_SET_PT_BOTH (Z, Z_BYTE);
+  else
+    TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint));
+
   set_buffer_internal_1 (old);
   /* Avoid an abort in TEMP_SET_PT_BOTH if the buffer has become
      shorter.  This can be caused by log truncation in *Messages*. */


reply via email to

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