aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/bytecomp.el50
1 files changed, 26 insertions, 24 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 4ee8b37719f..9fe6e036fbd 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1360,31 +1360,33 @@ extra args."
1360(dolist (elt '(format message error)) 1360(dolist (elt '(format message error))
1361 (put elt 'byte-compile-format-like t)) 1361 (put elt 'byte-compile-format-like t))
1362 1362
1363;; Warn if a custom definition fails to specify :group. 1363;; Warn if a custom definition fails to specify :group, or :type.
1364(defun byte-compile-nogroup-warn (form) 1364(defun byte-compile-nogroup-warn (form)
1365 (if (and (memq (car form) '(custom-declare-face custom-declare-variable)) 1365 (let ((keyword-args (cdr (cdr (cdr (cdr form)))))
1366 byte-compile-current-group) 1366 (name (cadr form)))
1367 ;; The group will be provided implicitly. 1367 (when (eq (car-safe name) 'quote)
1368 nil 1368 (or (not (eq (car form) 'custom-declare-variable))
1369 (let ((keyword-args (cdr (cdr (cdr (cdr form))))) 1369 (plist-get keyword-args :type)
1370 (name (cadr form))) 1370 (byte-compile-warn
1371 (or (not (eq (car-safe name) 'quote)) 1371 "defcustom for `%s' fails to specify type" (cadr name)))
1372 (and (eq (car form) 'custom-declare-group) 1372 (if (and (memq (car form) '(custom-declare-face custom-declare-variable))
1373 (equal name ''emacs)) 1373 byte-compile-current-group)
1374 (plist-get keyword-args :group) 1374 ;; The group will be provided implicitly.
1375 (not (and (consp name) (eq (car name) 'quote))) 1375 nil
1376 (byte-compile-warn 1376 (or (and (eq (car form) 'custom-declare-group)
1377 "%s for `%s' fails to specify containing group" 1377 (equal name ''emacs))
1378 (cdr (assq (car form) 1378 (plist-get keyword-args :group)
1379 '((custom-declare-group . defgroup) 1379 (byte-compile-warn
1380 (custom-declare-face . defface) 1380 "%s for `%s' fails to specify containing group"
1381 (custom-declare-variable . defcustom)))) 1381 (cdr (assq (car form)
1382 (cadr name))) 1382 '((custom-declare-group . defgroup)
1383 ;; Update the current group, if needed. 1383 (custom-declare-face . defface)
1384 (if (and byte-compile-current-file ;Only when compiling a whole file. 1384 (custom-declare-variable . defcustom))))
1385 (eq (car form) 'custom-declare-group) 1385 (cadr name)))
1386 (eq (car-safe name) 'quote)) 1386 ;; Update the current group, if needed.
1387 (setq byte-compile-current-group (cadr name)))))) 1387 (if (and byte-compile-current-file ;Only when compiling a whole file.
1388 (eq (car form) 'custom-declare-group))
1389 (setq byte-compile-current-group (cadr name)))))))
1388 1390
1389;; Warn if the function or macro is being redefined with a different 1391;; Warn if the function or macro is being redefined with a different
1390;; number of arguments. 1392;; number of arguments.