emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A way to get a list of available functions / variables?


From: Johannes Weiner
Subject: Re: A way to get a list of available functions / variables?
Date: Sun, 24 Feb 2008 17:38:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Hi,

Taylor Venable <address@hidden> writes:

> Is there a way to programmatically get the list of available functions?
> I'm thinking there must be a table somewhere which relates symbol names
> to actual function definitions, but can you get all the names in the
> table from Lisp code?  If so, my second question would then be if I
> could do the same for variables.

mapatoms might help:

(let (cmds vars)
  (mapatoms (lambda (atom)
              (cond
               ((commandp atom)
                (setq cmds (cons atom cmds)))
               ((custom-variable-p atom)
                (setq vars (cons atom vars)))))))

Or with CL functions and without distinguishing between commands and
variables:

(remove-if-not (lambda (atom)
                 (or (commandp atom)
                     (custom-variable-p atom)))
               obarray)

> The reason I ask is I've got this thing going on at my college where
> I'll write up an Emacs "function of the day" on the whiteboard in the
> computer science lounge.  It'd be cool if I could automate this process
> to automatically choose a random function or variable and build like an
> RSS feed of the results or something.  Because I don't know how many
> times I've been just randomly browsing around the documentation or
> source and found something like c-subword-mode that I otherwise would
> not have known even existed!

Sounds like a good idea.

        Hannes




reply via email to

[Prev in Thread] Current Thread [Next in Thread]