Function: defhydradio

defhydradio is a macro defined in hydra.el.

Signature

(defhydradio NAME BODY &rest HEADS)

Documentation

Create radios with prefix NAME.

_BODY specifies the options; there are none currently.
HEADS have the format:

    (TOGGLE-NAME &optional VALUE DOC)

TOGGLE-NAME will be used along with NAME to generate a variable name and a function that cycles it with the same name. VALUE should be an array. The first element of VALUE will be used to inialize the variable. VALUE defaults to [nil t]. DOC defaults to TOGGLE-NAME split and capitalized.

Source Code

;; Defined in ~/.emacs.d/elpa/hydra-20250316.1254/hydra.el
(defmacro defhydradio (name _body &rest heads)
  "Create radios with prefix NAME.
_BODY specifies the options; there are none currently.
HEADS have the format:

    (TOGGLE-NAME &optional VALUE DOC)

TOGGLE-NAME will be used along with NAME to generate a variable
name and a function that cycles it with the same name.  VALUE
should be an array.  The first element of VALUE will be used to
inialize the variable.
VALUE defaults to [nil t].
DOC defaults to TOGGLE-NAME split and capitalized."
  (declare (indent defun))
  `(progn
     ,@(apply #'append
              (mapcar (lambda (h)
                        (hydra--radio name h))
                      heads))
     (defvar ,(intern (format "%S/names" name))
       ',(mapcar (lambda (h) (intern (format "%S/%S" name (car h))))
                 heads))))