aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/keymap.c b/src/keymap.c
index fbdd31e0de3..e759214fa33 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1,5 +1,6 @@
1/* Manipulation of keymaps 1/* Manipulation of keymaps
2 Copyright (C) 1985-1988, 1993-1995, 1998-2012 Free Software Foundation, Inc. 2 Copyright (C) 1985-1988, 1993-1995, 1998-2013 Free Software
3 Foundation, Inc.
3 4
4This file is part of GNU Emacs. 5This file is part of GNU Emacs.
5 6
@@ -565,14 +566,13 @@ map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val)
565 if (!NILP (val)) 566 if (!NILP (val))
566 { 567 {
567 map_keymap_function_t fun 568 map_keymap_function_t fun
568 = (map_keymap_function_t) XSAVE_VALUE (XCAR (args))->pointer; 569 = (map_keymap_function_t) XSAVE_POINTER (args, 0);
569 args = XCDR (args);
570 /* If the key is a range, make a copy since map_char_table modifies 570 /* If the key is a range, make a copy since map_char_table modifies
571 it in place. */ 571 it in place. */
572 if (CONSP (key)) 572 if (CONSP (key))
573 key = Fcons (XCAR (key), XCDR (key)); 573 key = Fcons (XCAR (key), XCDR (key));
574 map_keymap_item (fun, XCDR (args), key, val, 574 map_keymap_item (fun, XSAVE_OBJECT (args, 2), key,
575 XSAVE_VALUE (XCAR (args))->pointer); 575 val, XSAVE_POINTER (args, 1));
576 } 576 }
577} 577}
578 578
@@ -610,12 +610,9 @@ map_keymap_internal (Lisp_Object map,
610 } 610 }
611 } 611 }
612 else if (CHAR_TABLE_P (binding)) 612 else if (CHAR_TABLE_P (binding))
613 { 613 map_char_table (map_keymap_char_table_item, Qnil, binding,
614 map_char_table (map_keymap_char_table_item, Qnil, binding, 614 make_save_value (SAVE_TYPE_PTR_PTR_OBJ,
615 Fcons (make_save_value ((void *) fun, 0), 615 fun, data, args));
616 Fcons (make_save_value (data, 0),
617 args)));
618 }
619 } 616 }
620 UNGCPRO; 617 UNGCPRO;
621 return tail; 618 return tail;
@@ -1249,7 +1246,7 @@ remapping in all currently active keymaps. */)
1249 return INTEGERP (command) ? Qnil : command; 1246 return INTEGERP (command) ? Qnil : command;
1250} 1247}
1251 1248
1252/* Value is number if KEY is too long; nil if valid but has no definition. */ 1249/* Value is number if KEY is too long; nil if valid but has no definition. */
1253/* GC is possible in this function. */ 1250/* GC is possible in this function. */
1254 1251
1255DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0, 1252DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0,
@@ -1541,7 +1538,7 @@ DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps,
1541 doc: /* Return a list of the currently active keymaps. 1538 doc: /* Return a list of the currently active keymaps.
1542OLP if non-nil indicates that we should obey `overriding-local-map' and 1539OLP if non-nil indicates that we should obey `overriding-local-map' and
1543`overriding-terminal-local-map'. POSITION can specify a click position 1540`overriding-terminal-local-map'. POSITION can specify a click position
1544like in the respective argument of `key-binding'. */) 1541like in the respective argument of `key-binding'. */)
1545 (Lisp_Object olp, Lisp_Object position) 1542 (Lisp_Object olp, Lisp_Object position)
1546{ 1543{
1547 ptrdiff_t count = SPECPDL_INDEX (); 1544 ptrdiff_t count = SPECPDL_INDEX ();
@@ -1550,7 +1547,7 @@ like in the respective argument of `key-binding'. */)
1550 1547
1551 /* If a mouse click position is given, our variables are based on 1548 /* If a mouse click position is given, our variables are based on
1552 the buffer clicked on, not the current buffer. So we may have to 1549 the buffer clicked on, not the current buffer. So we may have to
1553 switch the buffer here. */ 1550 switch the buffer here. */
1554 1551
1555 if (CONSP (position)) 1552 if (CONSP (position))
1556 { 1553 {
@@ -1559,8 +1556,8 @@ like in the respective argument of `key-binding'. */)
1559 window = POSN_WINDOW (position); 1556 window = POSN_WINDOW (position);
1560 1557
1561 if (WINDOWP (window) 1558 if (WINDOWP (window)
1562 && BUFFERP (XWINDOW (window)->buffer) 1559 && BUFFERP (XWINDOW (window)->contents)
1563 && XBUFFER (XWINDOW (window)->buffer) != current_buffer) 1560 && XBUFFER (XWINDOW (window)->contents) != current_buffer)
1564 { 1561 {
1565 /* Arrange to go back to the original buffer once we're done 1562 /* Arrange to go back to the original buffer once we're done
1566 processing the key sequence. We don't use 1563 processing the key sequence. We don't use
@@ -1570,7 +1567,7 @@ like in the respective argument of `key-binding'. */)
1570 things the same. 1567 things the same.
1571 */ 1568 */
1572 record_unwind_current_buffer (); 1569 record_unwind_current_buffer ();
1573 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); 1570 set_buffer_internal (XBUFFER (XWINDOW (window)->contents));
1574 } 1571 }
1575 } 1572 }
1576 1573
@@ -2047,7 +2044,7 @@ DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0,
2047Optional arg PREFIX is the sequence of keys leading up to KEYS. 2044Optional arg PREFIX is the sequence of keys leading up to KEYS.
2048For example, [?\C-x ?l] is converted into the string \"C-x l\". 2045For example, [?\C-x ?l] is converted into the string \"C-x l\".
2049 2046
2050The `kbd' macro is an approximate inverse of this. */) 2047For an approximate inverse of this, see `kbd'. */)
2051 (Lisp_Object keys, Lisp_Object prefix) 2048 (Lisp_Object keys, Lisp_Object prefix)
2052{ 2049{
2053 ptrdiff_t len = 0; 2050 ptrdiff_t len = 0;
@@ -2066,7 +2063,7 @@ The `kbd' macro is an approximate inverse of this. */)
2066 size += XINT (Flength (prefix)); 2063 size += XINT (Flength (prefix));
2067 2064
2068 /* This has one extra element at the end that we don't pass to Fconcat. */ 2065 /* This has one extra element at the end that we don't pass to Fconcat. */
2069 if (min (PTRDIFF_MAX, SIZE_MAX) / word_size / 4 < size) 2066 if (size > min (PTRDIFF_MAX, SIZE_MAX) / word_size / 4)
2070 memory_full (SIZE_MAX); 2067 memory_full (SIZE_MAX);
2071 SAFE_ALLOCA_LISP (args, size * 4); 2068 SAFE_ALLOCA_LISP (args, size * 4);
2072 2069
@@ -2315,7 +2312,6 @@ around function keys and event symbols. */)
2315 return Fcopy_sequence (key); 2312 return Fcopy_sequence (key);
2316 else 2313 else
2317 error ("KEY must be an integer, cons, symbol, or string"); 2314 error ("KEY must be an integer, cons, symbol, or string");
2318 return Qnil;
2319} 2315}
2320 2316
2321static char * 2317static char *