elisp: Generic Commands

 
 20.2.4 Select among Command Alternatives
 ----------------------------------------
 
 The macro ‘define-alternatives’ can be used to define “generic
 commands”.  These are interactive functions whose implementation can be
 selected from several alternatives, as a matter of user preference.
 
  -- Macro: define-alternatives command &rest customizations
      Define the new command COMMAND, a symbol.
 
      When a user runs ‘M-x COMMAND <RET>’ for the first time, Emacs
      prompts for which real form of the command to use, and records the
      selection by way of a custom variable.  Using a prefix argument
      repeats this process of choosing an alternative.
 
      The variable ‘COMMAND-alternatives’ should contain an alist with
      alternative implementations of COMMAND.  Until this variable is
      set, ‘define-alternatives’ has no effect.
 
      If CUSTOMIZATIONS is non-‘nil’, it should consist of alternating
      ‘defcustom’ keywords (typically ‘:group’ and ‘:version’) and values
      to add to the declaration of ‘COMMAND-alternatives’.