From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Richard Newsgroups: gmane.emacs.help Subject: Re: Programmatically access all the possible values of a defcustom Date: Thu, 30 Jan 2014 12:41:43 +0100 Message-ID: <87fvo5itmw.fsf@yahoo.fr> References: <86fvo6jzx5.fsf@somewhere.org> <86ha8lixj8.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1391082139 4183 80.91.229.3 (30 Jan 2014 11:42:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Jan 2014 11:42:19 +0000 (UTC) Cc: public-help-gnu-emacs-mXXj517/zsQ@plane.gmane.org To: "Sebastien Vauban" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 30 12:42:25 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W8q0m-00054J-LE for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Jan 2014 12:42:24 +0100 Original-Received: from localhost ([::1]:48044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8q0m-0007BC-0e for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Jan 2014 06:42:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8q0U-0007B7-8R for help-gnu-emacs@gnu.org; Thu, 30 Jan 2014 06:42:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8q0M-0000Sv-6j for help-gnu-emacs@gnu.org; Thu, 30 Jan 2014 06:42:06 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:35617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8q0M-0000Sl-0A for help-gnu-emacs@gnu.org; Thu, 30 Jan 2014 06:41:58 -0500 Original-Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W8q0K-0004nk-Rt for help-gnu-emacs@gnu.org; Thu, 30 Jan 2014 12:41:56 +0100 Original-Received: from mxin.ulb.ac.be ([164.15.128.112]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W8q04-0004eZ-ON; Thu, 30 Jan 2014 12:41:40 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EAJY56lKkD4Xx/2dsb2JhbABZwTqBHnSCJgEBBHkQCAMhJQ8BBEkth1YBFKtdlhkBiXMXh3KHEAeEOASYKIYxi26DLjs Original-Received: from mathsrv4.ulb.ac.be (HELO geodiff-mac3) ([164.15.133.241]) by smtp.ulb.ac.be with ESMTP; 30 Jan 2014 12:41:37 +0100 In-Reply-To: <86ha8lixj8.fsf@somewhere.org> (Sebastien Vauban's message of "Thu, 30 Jan 2014 11:17:31 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95792 Archived-At: "Sebastien Vauban" writes: > Now, I'll have to play with the list to obtain what I really want: > a string like... > > Awk, C, R, Asymptote, Calc, Clojure, CSS, Ditaa, Dot, Emacs Lisp, > Fortran The objects are "widgets", so e.g. (widget-get (get 'org-babel-load-languages 'custom-type) :key-type) will get you to the (choice ...) data which is documented at (info "(widget) composite") I'm unsure what's the best way to get rid of the [keyword value] pairs and only map over each inner (const ...) widget ; there ought to be something defined within the widget library but i couldn't find it. Or maybe my whole approach is wrong, I don't know. Anyway, this works for me : (mapconcat (lambda (widget) (widget-get widget :tag)) (cl-remove-if-not (lambda (it) (and (consp it) (eq (car it) 'const))) (cdr (widget-get (get 'org-babel-load-languages 'custom-type) :key-type))) ", ") -- Nico.