12

I'm reading the ido source and see:

(defgroup ido nil
 "Switch between files using substrings."
 :group 'extensions
 :group 'convenience
 :version "22.1"
 :link '(emacs-commentary-link :tag "Commentary" "ido.el")
 :link '(emacs-library-link :tag "Lisp File" "ido.el")
 :link '(custom-manual "(ido) Top")
 :link '(info-link "(ido) Customization"))

defgroup appears at the top of many large packages. I see it does this:

Declare SYMBOL as a customization group containing MEMBERS. SYMBOL does not need to be quoted.

And the page on customization groups doesn't really answer when or how to use them. When or how do you use them?

djechlin
  • 923
  • 8
  • 21

1 Answers1

10

When and why do you use any grouping? To be able to act on the group as a whole or on its individual members - only its members. That's the answer here also.

  • There are commands and other functions that act on a given group or set of groups. customize-group is one that acts on a given group. customize-apropos-groups is one that acts on a set of groups.

  • When you use customize-group you see links that let you customize subgroups (if any) and individual members (options and faces) of that group.

In addition, a group typically has a prefix, and you can use that for pattern-matching against function, face, etc. names when you interact with Emacs. This is another way of limiting actions to a given set (customization group) of things.

A group can also provide quick access to the online doc, source code, bug reporting, etc. for a package. Here, for instance, is the definition of group Icicles-Key-Completion (with some code elided).

(defgroup Icicles-Key-Completion nil
  "Icicles preferences related to key completion (`icicle-complete-keys')."
  :prefix "icicle-" :group 'Icicles
  :link `(url-link :tag "Send Bug Report" ...)
  :link '(url-link :tag "Other Libraries by Drew" ...)
  :link '(url-link :tag "Download" ...)
  :link '(url-link :tag "Description" ...)
  :link '(emacs-commentary-link :tag "Doc-Part2" "icicles-doc2")
  :link '(emacs-commentary-link :tag "Doc-Part1" "icicles-doc1"))

This group is itself a subgroup of group Icicles (see :group). It provides links in the Customize buffer for sending a bug report, downloading, and accessing the doc in the source code or on the Web.

Drew
  • 75,699
  • 9
  • 109
  • 225