help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Programmatically access all the possible values of a defcustom


From: Nicolas Richard
Subject: Re: Programmatically access all the possible values of a defcustom
Date: Thu, 30 Jan 2014 12:41:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)


"Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
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.




reply via email to

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