changeset 95642:1b0cbcea87b2

(byte-compile-current-group): New var. (byte-compile-file): Initialize it. (byte-compile-nogroup-warn): Keep track of the current group.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 08 Jun 2008 02:07:25 +0000
parents 23bdf2b1013d
children 2072976ded5e
files lisp/ChangeLog lisp/emacs-lisp/bytecomp.el
diffstat 2 files changed, 25 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Jun 08 01:23:11 2008 +0000
+++ b/lisp/ChangeLog	Sun Jun 08 02:07:25 2008 +0000
@@ -1,3 +1,9 @@
+2008-06-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/bytecomp.el (byte-compile-current-group): New var.
+	(byte-compile-file): Initialize it.
+	(byte-compile-nogroup-warn): Keep track of the current group.
+
 2008-06-08  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in (compile, compile-always, bootstrap-prepare):
@@ -7,7 +13,7 @@
 
 	* language/hanja-util.el (hanja-init-load): Use a char-table for
 	hanja-table.
-	(hangul-to-hanja-char): Adjusted for the above change.
+	(hangul-to-hanja-char): Adjust for the above change.
 
 2008-06-07  Glenn Morris  <rgm@gnu.org>
 
--- a/lisp/emacs-lisp/bytecomp.el	Sun Jun 08 01:23:11 2008 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Sun Jun 08 02:07:25 2008 +0000
@@ -924,6 +924,7 @@
 (defvar byte-compile-current-form nil)
 (defvar byte-compile-dest-file nil)
 (defvar byte-compile-current-file nil)
+(defvar byte-compile-current-group nil)
 (defvar byte-compile-current-buffer nil)
 
 ;; Log something that isn't a warning.
@@ -1335,9 +1336,13 @@
 
 ;; Warn if a custom definition fails to specify :group.
 (defun byte-compile-nogroup-warn (form)
-  (let ((keyword-args (cdr (cdr (cdr (cdr form)))))
-        (name (cadr form)))
-    (or (not (eq (car-safe name) 'quote))
+  (if (and (memq (car form) '(custom-declare-face custom-declare-variable))
+           byte-compile-current-group)
+      ;; The group will be provided implicitly.
+      nil
+    (let ((keyword-args (cdr (cdr (cdr (cdr form)))))
+          (name (cadr form)))
+      (or (not (eq (car-safe name) 'quote))
         (and (eq (car form) 'custom-declare-group)
              (equal name ''emacs))
         (plist-get keyword-args :group)
@@ -1345,10 +1350,15 @@
         (byte-compile-warn
          "%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)))))
+                      '((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 byte-compiling a whole file.
+               (eq (car form) 'custom-declare-group)
+               (eq (car-safe name) 'quote))
+          (setq byte-compile-current-group (cadr name))))))
 
 ;; Warn if the function or macro is being redefined with a different
 ;; number of arguments.
@@ -1713,6 +1723,7 @@
   ;; Force logging of the file name for each file compiled.
   (setq byte-compile-last-logged-file nil)
   (let ((byte-compile-current-file bytecomp-filename)
+        (byte-compile-current-group nil)
 	(set-auto-coding-for-load t)
 	target-file input-buffer output-buffer
 	byte-compile-dest-file)