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: Sebastien Vauban
Subject: Re: Programmatically access all the possible values of a defcustom
Date: Thu, 30 Jan 2014 13:40:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt)

Nicolas Richard wrote:
> "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)))
>            ", ")

You save me *a lot* of time: I'd have to "play" a lot before arriving to
such a code. Thanks!  (and it's perfectly what I was after)

Best regards,
  Seb

-- 
Sebastien Vauban


reply via email to

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