1

How can I programmatically check if a customize group exists?

Interactively I can use M-x customize-group and use completion to see if a specific group exists or not. But that's not what I need.

If I evaluate:

(customize-group "some-invalid-non-existing-group" nil)

Emacs will open a *Customize Group* buffer stating that the requested group is missing.

I'm writing code that programmatically opens a *Customize Group* buffer but I'd like to do that only if the group exists. So i'd need to check if a specific group name (held in a string) exists prior to programatically calling the customize-group function.

How to do that?

3

Cribbing from cus-edit.el gets you this:

(let (custom-groups)
  (mapatoms (lambda (symbol)
              (when (or (and (get symbol 'custom-loads)
                           (not (get symbol 'custom-autoload)))
                      (get symbol 'custom-group))
                (push symbol custom-groups))))
  custom-groups)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.