From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Taylor Venable Newsgroups: gmane.emacs.devel Subject: Re: A way to get a list of available functions / variables? Date: Sun, 24 Feb 2008 20:42:57 -0500 Organization: Church of Emacs Message-ID: <87mypp24m6.fsf@lionel.metasyntax.net> References: <87bq665nsz.fsf@lionel.metasyntax.net> <874pbyb97l.fsf@saeurebad.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1203903807 28387 80.91.229.12 (25 Feb 2008 01:43:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Feb 2008 01:43:27 +0000 (UTC) Cc: emacs-devel@gnu.org To: Johannes Weiner Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 25 02:43:51 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JTSNd-0002Ij-Ea for ged-emacs-devel@m.gmane.org; Mon, 25 Feb 2008 02:43:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTSN7-0005vj-Sf for ged-emacs-devel@m.gmane.org; Sun, 24 Feb 2008 20:43:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JTSN1-0005u3-Au for emacs-devel@gnu.org; Sun, 24 Feb 2008 20:43:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JTSMz-0005sx-Qa for emacs-devel@gnu.org; Sun, 24 Feb 2008 20:43:07 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTSMz-0005su-Nv for emacs-devel@gnu.org; Sun, 24 Feb 2008 20:43:05 -0500 Original-Received: from mout.perfora.net ([74.208.4.197]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JTSMz-0006la-DO for emacs-devel@gnu.org; Sun, 24 Feb 2008 20:43:05 -0500 Original-Received: from lionel.metasyntax.net.metasyntax.net (pool-71-188-190-197.aubnin.fios.verizon.net [71.188.190.197]) by mrelay.perfora.net (node=mrus0) with ESMTP (Nemesis) id 0MKp8S-1JTSMu1hG8-0003l4; Sun, 24 Feb 2008 20:43:03 -0500 In-Reply-To: <874pbyb97l.fsf@saeurebad.de> (Johannes Weiner's message of "Sun, 24 Feb 2008 17:38:54 +0100") User-Agent: Gnus 5.13 / Emacs 23.0.60.2 X-Provags-ID: V01U2FsdGVkX183l11ZwQQUs597z4dLlXqfALDCbeKEhOmJjr/ zbQve9nA4LxqzIQB4HIeGuuV1PQoRldUyw5k+pQHAXkkzwj9BO Hc2QqJB3BGhB0Bo58zAlQ== X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:90327 Archived-At: Johannes Weiner 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))))))) That is very cool, thanks much! >> 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. Thanks; I'll post to emacs-help when I get it finished and working suitably. -- Taylor Venable http://real.metasyntax.net:2357/ foldr = lambda f, i, l: (len(l) == 1 and [f(l[0], i)] or [f(l[0], foldr(f, i, l[1:]))])[0]