summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2013-11-16 11:27:19 +0200
committerEli Zaretskii <eliz@gnu.org>2013-11-16 11:27:19 +0200
commit3d6dec8d1ef99202a00c58a6ebdc3aaac7d83de6 (patch)
treeed5ad2da4625ee00c65db2fe318e2c717bd4f32f
parent43cebc237c147aecf53b6d2dc64f5df3e92b4d98 (diff)
downloademacs-3d6dec8d1ef99202a00c58a6ebdc3aaac7d83de6.tar.gz
Fix bug #15907 with crashes due to after-change-functions.
src/keymap.c (describe_map): Don't crash if PT is 1 both before and after inserting the description string.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/keymap.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f92eb7b85fc..696475c17e5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/keymap.c b/src/keymap.c
index 7a18cd5d983..562787ee8a5 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -3383,9 +3383,12 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
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)");
- SET_PT (PT + 1);
+ pt = min (PT + 1, Z);
+ SET_PT (pt);
}
}