From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: elisp - introspection - find all functions matching a certain string
Date: Thu, 06 Sep 2007 09:28:06 +0200 [thread overview]
Message-ID: <87tzq8l0c9.fsf@baldur.tsdh.de> (raw)
In-Reply-To: 1189024939.191385.47270@r29g2000hsg.googlegroups.com
"metaperl.com" <metaperl@gmail.com> writes:
Hi,
>> How can I get a list of all the Emacs Lisp functions currently in
>> memory which start with the string "asciidoc"
>
> It occurred to me to hijack the source of apropos.el, but the function
> which does all the work, apropos-internal, does not appear in the
> source anywhere.
,----[ C-h f apropos-internal RET ]
| apropos-internal is a built-in function in `C source code'.
| (apropos-internal REGEXP &optional PREDICATE)
|
| Show all symbols whose names contain match for REGEXP.
| If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done
| for each symbol and a symbol is mentioned only if that returns non-nil.
| Return list of symbols found.
`----
As you can see, it's defined in the C source code.
Regarding your original problem, you can also use this function:
--8<---------------cut here---------------start------------->8---
(defun matching-functions (regexp)
(let (commands)
(mapatoms (lambda (a)
(if (and (functionp a)
(string-match regexp (symbol-name a)))
(push (symbol-name a)
commands))))
(sort commands 'string-lessp)))
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
--
If programmers deserve to be rewarded for creating innovative programs,
by the same token they deserve to be punished if they restrict the use
of these programs. (Richard M. Stallman)
next prev parent reply other threads:[~2007-09-06 7:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-05 20:04 elisp - introspection - find all functions matching a certain string metaperl.com
2007-09-05 20:42 ` metaperl.com
2007-09-06 7:28 ` Tassilo Horn [this message]
2007-09-05 20:58 ` metaperl.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tzq8l0c9.fsf@baldur.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.