]> code.delx.au - gnu-emacs/commitdiff
Fix bug #15907 with crashes due to after-change-functions.
authorEli Zaretskii <eliz@gnu.org>
Sat, 16 Nov 2013 09:27:19 +0000 (11:27 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 16 Nov 2013 09:27:19 +0000 (11:27 +0200)
 src/keymap.c (describe_map): Don't crash if PT is 1 both before and
 after inserting the description string.

src/ChangeLog
src/keymap.c

index f92eb7b85fc8f7d4ec9a866e57b2edf0ac38be7f..696475c17e52ea2c76c0e4bf01f40bc6d79ccfa6 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-16  Eli Zaretskii  <eliz@gnu.org>
+
+       * keymap.c (describe_map): Don't crash if PT is 1 both before and
+       after inserting the description string.  (Bug#15907)
+
 2013-11-15  Paul Eggert  <eggert@cs.ucla.edu>
 
        * data.c: Work around bogus GCC diagnostic about shift count.
 2013-11-15  Paul Eggert  <eggert@cs.ucla.edu>
 
        * data.c: Work around bogus GCC diagnostic about shift count.
index 7a18cd5d98386e07a80c05034b33122b9ef177e3..562787ee8a59ae09d50c54ef43c4cadc077ae44f 100644 (file)
@@ -3383,9 +3383,12 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
 
       if (vect[i].shadowed)
        {
 
       if (vect[i].shadowed)
        {
-         SET_PT (PT - 1);
+         ptrdiff_t pt = max (PT - 1, BEG);
+
+         SET_PT (pt);
          insert_string ("\n  (that binding is currently shadowed by another mode)");
          insert_string ("\n  (that binding is currently shadowed by another mode)");
-         SET_PT (PT + 1);
+         pt = min (PT + 1, Z);
+         SET_PT (pt);
        }
     }
 
        }
     }