summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-06-08 02:07:25 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-06-08 02:07:25 +0000
commitab5111e3df50ec7c21ffc86fb19e969db23c1f85 (patch)
treee051e96d4f39e29737612320fee138b2f4d03ea0 /lisp/emacs-lisp
parent2c01ac6a3f86b688a80d51e1364e2ebedd83ddee (diff)
downloademacs-ab5111e3df50ec7c21ffc86fb19e969db23c1f85.tar.gz
emacs-ab5111e3df50ec7c21ffc86fb19e969db23c1f85.tar.bz2
emacs-ab5111e3df50ec7c21ffc86fb19e969db23c1f85.zip
(byte-compile-current-group): New var.
(byte-compile-file): Initialize it. (byte-compile-nogroup-warn): Keep track of the current group.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el25
1 files changed, 18 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index e0a3f2221e2..1908e5790dd 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -924,6 +924,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
(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 @@ extra args."
;; 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 @@ extra args."
(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 @@ The value is non-nil if there were no errors, nil if errors."
;; 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)