aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
authorEli Zaretskii2014-10-14 21:10:37 +0300
committerEli Zaretskii2014-10-14 21:10:37 +0300
commite3060a0c4d2f418ac786775109d71e5843ccf42e (patch)
tree347b37fc39d0db9cd23b3e9f79ee81b4bbc40f08 /src/keymap.c
parent1a3eca0656bdb764200e10a4f264138e94b1f3ce (diff)
parent980d78b3587560c13a46aef352ed8d5ed744acf6 (diff)
downloademacs-e3060a0c4d2f418ac786775109d71e5843ccf42e.tar.gz
emacs-e3060a0c4d2f418ac786775109d71e5843ccf42e.zip
Merge from trunk and resolve conflicts.
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/keymap.c b/src/keymap.c
index f4dd644aebd..c7c7d196c22 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1299,11 +1299,8 @@ define_as_prefix (Lisp_Object keymap, Lisp_Object c)
1299static Lisp_Object 1299static Lisp_Object
1300append_key (Lisp_Object key_sequence, Lisp_Object key) 1300append_key (Lisp_Object key_sequence, Lisp_Object key)
1301{ 1301{
1302 Lisp_Object args[2]; 1302 AUTO_LIST1 (key_list, key);
1303 1303 return Fvconcat (2, ((Lisp_Object []) { key_sequence, key_list }));
1304 args[0] = key_sequence;
1305 args[1] = list1 (key);
1306 return Fvconcat (2, args);
1307} 1304}
1308 1305
1309/* Given a event type C which is a symbol, 1306/* Given a event type C which is a symbol,
@@ -1342,7 +1339,8 @@ silly_event_symbol_error (Lisp_Object c)
1342 *p = 0; 1339 *p = 0;
1343 1340
1344 c = reorder_modifiers (c); 1341 c = reorder_modifiers (c);
1345 keystring = concat2 (build_string (new_mods), XCDR (assoc)); 1342 AUTO_STRING (new_mods_string, new_mods);
1343 keystring = concat2 (new_mods_string, XCDR (assoc));
1346 1344
1347 error ("To bind the key %s, use [?%s], not [%s]", 1345 error ("To bind the key %s, use [?%s], not [%s]",
1348 SDATA (SYMBOL_NAME (c)), SDATA (keystring), 1346 SDATA (SYMBOL_NAME (c)), SDATA (keystring),
@@ -2239,14 +2237,19 @@ Optional argument NO-ANGLES non-nil means don't put angle brackets
2239around function keys and event symbols. */) 2237around function keys and event symbols. */)
2240 (Lisp_Object key, Lisp_Object no_angles) 2238 (Lisp_Object key, Lisp_Object no_angles)
2241{ 2239{
2240 USE_SAFE_ALLOCA;
2241
2242 if (CONSP (key) && lucid_event_type_list_p (key)) 2242 if (CONSP (key) && lucid_event_type_list_p (key))
2243 key = Fevent_convert_list (key); 2243 key = Fevent_convert_list (key);
2244 2244
2245 if (CONSP (key) && INTEGERP (XCAR (key)) && INTEGERP (XCDR (key))) 2245 if (CONSP (key) && INTEGERP (XCAR (key)) && INTEGERP (XCDR (key)))
2246 /* An interval from a map-char-table. */ 2246 /* An interval from a map-char-table. */
2247 return concat3 (Fsingle_key_description (XCAR (key), no_angles), 2247 {
2248 build_string (".."), 2248 AUTO_STRING (dot_dot, "..");
2249 Fsingle_key_description (XCDR (key), no_angles)); 2249 return concat3 (Fsingle_key_description (XCAR (key), no_angles),
2250 dot_dot,
2251 Fsingle_key_description (XCDR (key), no_angles));
2252 }
2250 2253
2251 key = EVENT_HEAD (key); 2254 key = EVENT_HEAD (key);
2252 2255
@@ -2262,7 +2265,6 @@ around function keys and event symbols. */)
2262 if (NILP (no_angles)) 2265 if (NILP (no_angles))
2263 { 2266 {
2264 Lisp_Object result; 2267 Lisp_Object result;
2265 USE_SAFE_ALLOCA;
2266 char *buffer = SAFE_ALLOCA (sizeof "<>" 2268 char *buffer = SAFE_ALLOCA (sizeof "<>"
2267 + SBYTES (SYMBOL_NAME (key))); 2269 + SBYTES (SYMBOL_NAME (key)));
2268 esprintf (buffer, "<%s>", SDATA (SYMBOL_NAME (key))); 2270 esprintf (buffer, "<%s>", SDATA (SYMBOL_NAME (key)));
@@ -2883,13 +2885,14 @@ You type Translation\n\
2883 if (!SYMBOLP (modes[i])) 2885 if (!SYMBOLP (modes[i]))
2884 emacs_abort (); 2886 emacs_abort ();
2885 2887
2886 p = title = alloca (42 + SCHARS (SYMBOL_NAME (modes[i]))); 2888 USE_SAFE_ALLOCA;
2889 p = title = SAFE_ALLOCA (42 + SBYTES (SYMBOL_NAME (modes[i])));
2887 *p++ = '\f'; 2890 *p++ = '\f';
2888 *p++ = '\n'; 2891 *p++ = '\n';
2889 *p++ = '`'; 2892 *p++ = '`';
2890 memcpy (p, SDATA (SYMBOL_NAME (modes[i])), 2893 memcpy (p, SDATA (SYMBOL_NAME (modes[i])),
2891 SCHARS (SYMBOL_NAME (modes[i]))); 2894 SBYTES (SYMBOL_NAME (modes[i])));
2892 p += SCHARS (SYMBOL_NAME (modes[i])); 2895 p += SBYTES (SYMBOL_NAME (modes[i]));
2893 *p++ = '\''; 2896 *p++ = '\'';
2894 memcpy (p, " Minor Mode Bindings", strlen (" Minor Mode Bindings")); 2897 memcpy (p, " Minor Mode Bindings", strlen (" Minor Mode Bindings"));
2895 p += strlen (" Minor Mode Bindings"); 2898 p += strlen (" Minor Mode Bindings");
@@ -2898,6 +2901,7 @@ You type Translation\n\
2898 describe_map_tree (maps[i], 1, shadow, prefix, 2901 describe_map_tree (maps[i], 1, shadow, prefix,
2899 title, nomenu, 0, 0, 0); 2902 title, nomenu, 0, 0, 0);
2900 shadow = Fcons (maps[i], shadow); 2903 shadow = Fcons (maps[i], shadow);
2904 SAFE_FREE ();
2901 } 2905 }
2902 2906
2903 start1 = get_local_map (BUF_PT (XBUFFER (buffer)), 2907 start1 = get_local_map (BUF_PT (XBUFFER (buffer)),
@@ -3184,10 +3188,10 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
3184 3188
3185 /* These accumulate the values from sparse keymap bindings, 3189 /* These accumulate the values from sparse keymap bindings,
3186 so we can sort them and handle them in order. */ 3190 so we can sort them and handle them in order. */
3187 int length_needed = 0; 3191 ptrdiff_t length_needed = 0;
3188 struct describe_map_elt *vect; 3192 struct describe_map_elt *vect;
3189 int slots_used = 0; 3193 ptrdiff_t slots_used = 0;
3190 int i; 3194 ptrdiff_t i;
3191 3195
3192 suppress = Qnil; 3196 suppress = Qnil;
3193 3197
@@ -3207,7 +3211,8 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
3207 for (tail = map; CONSP (tail); tail = XCDR (tail)) 3211 for (tail = map; CONSP (tail); tail = XCDR (tail))
3208 length_needed++; 3212 length_needed++;
3209 3213
3210 vect = alloca (length_needed * sizeof *vect); 3214 USE_SAFE_ALLOCA;
3215 SAFE_NALLOCA (vect, 1, length_needed);
3211 3216
3212 for (tail = map; CONSP (tail); tail = XCDR (tail)) 3217 for (tail = map; CONSP (tail); tail = XCDR (tail))
3213 { 3218 {
@@ -3350,6 +3355,7 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
3350 } 3355 }
3351 } 3356 }
3352 3357
3358 SAFE_FREE ();
3353 UNGCPRO; 3359 UNGCPRO;
3354} 3360}
3355 3361
@@ -3358,7 +3364,7 @@ describe_vector_princ (Lisp_Object elt, Lisp_Object fun)
3358{ 3364{
3359 Findent_to (make_number (16), make_number (1)); 3365 Findent_to (make_number (16), make_number (1));
3360 call1 (fun, elt); 3366 call1 (fun, elt);
3361 Fterpri (Qnil); 3367 Fterpri (Qnil, Qnil);
3362} 3368}
3363 3369
3364DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0, 3370DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0,
@@ -3438,9 +3444,9 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3438 /* Call Fkey_description first, to avoid GC bug for the other string. */ 3444 /* Call Fkey_description first, to avoid GC bug for the other string. */
3439 if (!NILP (prefix) && XFASTINT (Flength (prefix)) > 0) 3445 if (!NILP (prefix) && XFASTINT (Flength (prefix)) > 0)
3440 { 3446 {
3441 Lisp_Object tem; 3447 Lisp_Object tem = Fkey_description (prefix, Qnil);
3442 tem = Fkey_description (prefix, Qnil); 3448 AUTO_STRING (space, " ");
3443 elt_prefix = concat2 (tem, build_string (" ")); 3449 elt_prefix = concat2 (tem, space);
3444 } 3450 }
3445 prefix = Qnil; 3451 prefix = Qnil;
3446 } 3452 }