unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* elisp - introspection - find all functions matching a certain string
@ 2007-09-05 20:04 metaperl.com
  2007-09-05 20:42 ` metaperl.com
  2007-09-05 20:58 ` metaperl.com
  0 siblings, 2 replies; 4+ messages in thread
From: metaperl.com @ 2007-09-05 20:04 UTC (permalink / raw)
  To: help-gnu-emacs

How can I get a list of all the Emacs Lisp functions currently in
memory which start with the string "asciidoc"

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: elisp - introspection - find all functions matching a certain string
  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
  2007-09-05 20:58 ` metaperl.com
  1 sibling, 1 reply; 4+ messages in thread
From: metaperl.com @ 2007-09-05 20:42 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 5, 4:04 pm, "metaperl.com" <metap...@gmail.com> wrote:
> 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. And apropos.el does not have any requires... I simply
dont get it!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: elisp - introspection - find all functions matching a certain string
  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-05 20:58 ` metaperl.com
  1 sibling, 0 replies; 4+ messages in thread
From: metaperl.com @ 2007-09-05 20:58 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 5, 4:04 pm, "metaperl.com" <metap...@gmail.com> wrote:
> How can I get a list of all the Emacs Lisp functions currently in
> memory which start with the string "asciidoc"
>
> Thanks

Ok I got it. apropos-internal is a C function and here is how I get
what I want:

  (setq apropos-accumulator
	  (apropos-internal apropos-regexp (lambda (symbol) (functionp
symbol))))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: elisp - introspection - find all functions matching a certain string
  2007-09-05 20:42 ` metaperl.com
@ 2007-09-06  7:28   ` Tassilo Horn
  0 siblings, 0 replies; 4+ messages in thread
From: Tassilo Horn @ 2007-09-06  7:28 UTC (permalink / raw)
  To: help-gnu-emacs

"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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-09-06  7:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-09-05 20:58 ` metaperl.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).