Function: shortdoc--check

shortdoc--check is a byte-compiled function defined in shortdoc.el.gz.

Signature

(shortdoc--check GROUP DEFINITION)

Documentation

Ensure that (GROUP DEFINITION) is a valid shortdoc group definition.

Signal an error if that is not the case.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/shortdoc.el.gz
(defun shortdoc--check (group definition)
  "Ensure that (GROUP DEFINITION) is a valid shortdoc group definition.
Signal an error if that is not the case."
  (unless (symbolp group)
    (signal 'wrong-type-argument (list 'symbolp group)))
  (unless (proper-list-p definition)
    (signal 'wrong-type-argument (list 'proper-list-p definition)))
  (let ((has-content nil)
        entry keyword type
        (prev-type 'group-name))
    (while definition
      (setq entry (car definition)
            keyword (car-safe entry)
            type (cond
                  ((and (eq keyword :group)
                        (shortdoc--keyword-plist-p (cdr entry)))
                   'group-properties)
                  ((stringp entry) 'section-title)
                  ((and (eq keyword :section)
                        (shortdoc--keyword-plist-p (cdr entry)))
                   'section-properties)
                  ((and (eq keyword :item)
                        (shortdoc--keyword-plist-p entry))
                   'item-definition)
                  ((and (consp entry)
                        (shortdoc--keyword-plist-p (cdr entry)))
                   'item-definition)
                  (t 'invalid)))
      (cond ((memq type '(section-title item-definition))
             (setq has-content t))
            ((and (eq type 'group-properties)
                  (eq prev-type 'group-name)))
            ((and (eq type 'section-properties)
                  (eq prev-type 'section-title)))
            (t
             (error "Shortdoc group %s with invalid entry %S"
                              group entry)))
      (setq prev-type type
            definition (cdr definition)))
    (unless has-content
      (error "Shortdoc group %s without content" group))))