Mercurial > emacs
comparison src/keymap.c @ 35781:ffdcf20f53f2
(Fwhere_is_internal): Use the first valid binding
if no ascii binding is found (when firstonly is t).
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 31 Jan 2001 15:19:30 +0000 |
parents | 952bdd6fb8e5 |
children | 274190d289d7 |
comparison
equal
deleted
inserted
replaced
35780:a4119c7b821f | 35781:ffdcf20f53f2 |
---|---|
2265 /* Only use caching for the menubar (i.e. called with (def nil t nil). | 2265 /* Only use caching for the menubar (i.e. called with (def nil t nil). |
2266 We don't really need to check `keymap'. */ | 2266 We don't really need to check `keymap'. */ |
2267 if (nomenus && NILP (noindirect) && NILP (keymap)) | 2267 if (nomenus && NILP (noindirect) && NILP (keymap)) |
2268 { | 2268 { |
2269 Lisp_Object *defns; | 2269 Lisp_Object *defns; |
2270 int i, n; | 2270 int i, j, n; |
2271 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 2271 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
2272 | 2272 |
2273 /* Check heuristic-consistency of the cache. */ | 2273 /* Check heuristic-consistency of the cache. */ |
2274 if (NILP (Fequal (keymaps, where_is_cache_keymaps))) | 2274 if (NILP (Fequal (keymaps, where_is_cache_keymaps))) |
2275 where_is_cache = Qnil; | 2275 where_is_cache = Qnil; |
2300 | 2300 |
2301 /* Verify that the key bindings are not shadowed. Note that | 2301 /* Verify that the key bindings are not shadowed. Note that |
2302 the following can GC. */ | 2302 the following can GC. */ |
2303 GCPRO2 (definition, keymaps); | 2303 GCPRO2 (definition, keymaps); |
2304 result = Qnil; | 2304 result = Qnil; |
2305 j = -1; | |
2305 for (i = n - 1; i >= 0; --i) | 2306 for (i = n - 1; i >= 0; --i) |
2306 if (EQ (shadow_lookup (keymaps, defns[i], Qnil), definition) | 2307 if (EQ (shadow_lookup (keymaps, defns[i], Qnil), definition)) |
2307 && ascii_sequence_p (defns[i])) | 2308 { |
2308 break; | 2309 if (ascii_sequence_p (defns[i])) |
2309 | 2310 break; |
2310 result = i >= 0 ? defns[i] : Qnil; | 2311 else if (j < 0) |
2312 j = i; | |
2313 } | |
2314 | |
2315 result = i >= 0 ? defns[i] : (j >= 0 ? defns[j] : Qnil); | |
2311 UNGCPRO; | 2316 UNGCPRO; |
2312 } | 2317 } |
2313 else | 2318 else |
2314 { | 2319 { |
2315 /* Kill the cache so that where_is_internal_1 doesn't think | 2320 /* Kill the cache so that where_is_internal_1 doesn't think |