all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org
Subject: Re: Programmatically access all the possible values of a defcustom
Date: Thu, 30 Jan 2014 13:40:26 +0100	[thread overview]
Message-ID: <86lhxxhccl.fsf@somewhere.org> (raw)
In-Reply-To: mailman.13179.1391082135.10748.help-gnu-emacs@gnu.org

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


      parent reply	other threads:[~2014-01-30 12:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-29 20:28 Programmatically access all the possible values of a defcustom Sebastien Vauban
2014-01-29 22:19 ` Nicolas Richard
     [not found] ` <mailman.13125.1391033975.10748.help-gnu-emacs@gnu.org>
2014-01-30 10:17   ` Sebastien Vauban
2014-01-30 11:41     ` Nicolas Richard
     [not found]     ` <mailman.13179.1391082135.10748.help-gnu-emacs@gnu.org>
2014-01-30 12:40       ` Sebastien Vauban [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86lhxxhccl.fsf@somewhere.org \
    --to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
    --cc=help-gnu-emacs-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.