Function: byte-compile-nogroup-warn

byte-compile-nogroup-warn is a byte-compiled function defined in bytecomp.el.gz.

Signature

(byte-compile-nogroup-warn FORM)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
;; Warn if a custom definition fails to specify :group, or :type.
(defun byte-compile-nogroup-warn (form)
  (let ((keyword-args (cdr (cdr (cdr (cdr form)))))
	(name (cadr form)))
    (when (eq (car-safe name) 'quote)
      (when (eq (car form) 'custom-declare-variable)
        (let ((type (plist-get keyword-args :type)))
	  (cond
           ((not type)
	    (byte-compile-warn-x (cadr name)
                                 "defcustom for `%s' fails to specify type"
                                 (cadr name)))
           ((byte-compile--suspicious-defcustom-choice type)
	    (byte-compile-warn-x
             (cadr name)
	     "defcustom for `%s' has syntactically odd type `%s'"
             (cadr name) type)))))
      (if (and (memq (car form) '(custom-declare-face custom-declare-variable))
	       byte-compile-current-group)
	  ;; The group will be provided implicitly.
	  nil
	(or (and (eq (car form) 'custom-declare-group)
		 (equal name ''emacs))
	    (plist-get keyword-args :group)
	    (byte-compile-warn-x (cadr name)
	     "%s for `%s' fails to specify containing group"
	     (cdr (assq (car form)
			'((custom-declare-group . defgroup)
			  (custom-declare-face . defface)
			  (custom-declare-variable . defcustom))))
	     (cadr name)))
	;; Update the current group, if needed.
	(if (and byte-compile-current-file ;Only when compiling a whole file.
		 (eq (car form) 'custom-declare-group))
	    (setq byte-compile-current-group (cadr name)))))))