Mercurial > emacs
comparison src/keymap.c @ 89323:6ca0b3586d5f
(apropos_predicate, apropos_accumulate): Declare
static.
(Fapropos_internal): Don't gcpro apropos_accumulate. Set result
to new local and nullify apropos_accumulate before returning.
(syms_of_keymap): Staticpro and initialize apropos_accumulate.
author | Dave Love <fx@gnu.org> |
---|---|
date | Fri, 03 Jan 2003 20:24:54 +0000 |
parents | c5637be14c7f |
children | 1eac05a60b66 |
comparison
equal
deleted
inserted
replaced
89322:dcddf6c63960 | 89323:6ca0b3586d5f |
---|---|
1 /* Manipulation of keymaps | 1 /* Manipulation of keymaps |
2 Copyright (C) 1985, 86,87,88,93,94,95,98,99, 2000, 2001 | 2 Copyright (C) 1985, 86,87,88,93,94,95,98,99, 2000, 01, 02, 03 |
3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GNU Emacs. | 5 This file is part of GNU Emacs. |
6 | 6 |
7 GNU Emacs is free software; you can redistribute it and/or modify | 7 GNU Emacs is free software; you can redistribute it and/or modify |
3264 UNGCPRO; | 3264 UNGCPRO; |
3265 } | 3265 } |
3266 | 3266 |
3267 | 3267 |
3268 /* Apropos - finding all symbols whose names match a regexp. */ | 3268 /* Apropos - finding all symbols whose names match a regexp. */ |
3269 Lisp_Object apropos_predicate; | 3269 static Lisp_Object apropos_predicate; |
3270 Lisp_Object apropos_accumulate; | 3270 static Lisp_Object apropos_accumulate; |
3271 | 3271 |
3272 static void | 3272 static void |
3273 apropos_accum (symbol, string) | 3273 apropos_accum (symbol, string) |
3274 Lisp_Object symbol, string; | 3274 Lisp_Object symbol, string; |
3275 { | 3275 { |
3281 if (!NILP (tem)) | 3281 if (!NILP (tem)) |
3282 apropos_accumulate = Fcons (symbol, apropos_accumulate); | 3282 apropos_accumulate = Fcons (symbol, apropos_accumulate); |
3283 } | 3283 } |
3284 | 3284 |
3285 DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0, | 3285 DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0, |
3286 doc: /* Show all symbols whose names contain match for REGEXP. | 3286 doc: /* Find all symbols whose names contain match for REGEXP. |
3287 If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done | 3287 If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done |
3288 for each symbol and a symbol is mentioned only if that returns non-nil. | 3288 for each symbol and a symbol is mentioned only if that returns non-nil. |
3289 Return list of symbols found. */) | 3289 Return list of symbols found. */) |
3290 (regexp, predicate) | 3290 (regexp, predicate) |
3291 Lisp_Object regexp, predicate; | 3291 Lisp_Object regexp, predicate; |
3292 { | 3292 { |
3293 struct gcpro gcpro1, gcpro2; | 3293 struct gcpro gcpro1; |
3294 Lisp_Object result; | |
3294 CHECK_STRING (regexp); | 3295 CHECK_STRING (regexp); |
3295 apropos_predicate = predicate; | 3296 apropos_predicate = predicate; |
3296 GCPRO2 (apropos_predicate, apropos_accumulate); | 3297 GCPRO1 (apropos_predicate); |
3297 apropos_accumulate = Qnil; | 3298 apropos_accumulate = Qnil; /* staticpro'd */ |
3298 map_obarray (Vobarray, apropos_accum, regexp); | 3299 map_obarray (Vobarray, apropos_accum, regexp); |
3299 apropos_accumulate = Fsort (apropos_accumulate, Qstring_lessp); | 3300 result = Fsort (apropos_accumulate, Qstring_lessp); |
3300 UNGCPRO; | 3301 UNGCPRO; |
3301 return apropos_accumulate; | 3302 apropos_accumulate = Qnil; /* Allow the result to be GCed. */ |
3303 return result; | |
3302 } | 3304 } |
3303 | 3305 |
3304 void | 3306 void |
3305 syms_of_keymap () | 3307 syms_of_keymap () |
3306 { | 3308 { |
3430 | 3432 |
3431 where_is_cache_keymaps = Qt; | 3433 where_is_cache_keymaps = Qt; |
3432 where_is_cache = Qnil; | 3434 where_is_cache = Qnil; |
3433 staticpro (&where_is_cache); | 3435 staticpro (&where_is_cache); |
3434 staticpro (&where_is_cache_keymaps); | 3436 staticpro (&where_is_cache_keymaps); |
3437 apropos_accumulate = Qnil; | |
3438 staticpro (&apropos_accumulate); | |
3435 | 3439 |
3436 defsubr (&Skeymapp); | 3440 defsubr (&Skeymapp); |
3437 defsubr (&Skeymap_parent); | 3441 defsubr (&Skeymap_parent); |
3438 defsubr (&Skeymap_prompt); | 3442 defsubr (&Skeymap_prompt); |
3439 defsubr (&Sset_keymap_parent); | 3443 defsubr (&Sset_keymap_parent); |