]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/bytecomp.el
* lisp/emacs-lisp/checkdoc.el (checkdoc-get-keywords):
[gnu-emacs] / lisp / emacs-lisp / bytecomp.el
index e929c02eefbf9a0bc90d7361b132fe1085c32edc..efd43898b60c3c1350a27466d07ecf31150a6994 100644 (file)
@@ -348,7 +348,7 @@ else the global value will be modified."
 ;;;###autoload
 (defun byte-compile-enable-warning (warning)
   "Change `byte-compile-warnings' to enable WARNING.
-If `byte-compile-warnings' is `t', do nothing.  Otherwise, if the
+If `byte-compile-warnings' is t, do nothing.  Otherwise, if the
 first element is `not', remove WARNING, else add it.
 Normally you should let-bind `byte-compile-warnings' before calling this,
 else the global value will be modified."
@@ -1799,7 +1799,7 @@ The value is non-nil if there were no errors, nil if errors."
             (progn
               (setq-default major-mode 'emacs-lisp-mode)
               ;; Arg of t means don't alter enable-local-variables.
-              (normal-mode t))
+              (delay-mode-hooks (normal-mode t)))
           (setq-default major-mode dmm))
         ;; There may be a file local variable setting (bug#10419).
         (setq buffer-read-only nil
@@ -2920,11 +2920,17 @@ for symbols generated by the byte compiler itself."
 
 ;; Special macro-expander used during byte-compilation.
 (defun byte-compile-macroexpand-declare-function (fn file &rest args)
-  (push (cons fn
-              (if (and (consp args) (listp (car args)))
-                  (list 'declared (car args))
-                t))                     ; Arglist not specified.
-        byte-compile-function-environment)
+  (let ((gotargs (and (consp args) (listp (car args))))
+       (unresolved (assq fn byte-compile-unresolved-functions)))
+    (when unresolved         ; function was called before declaration
+      (if (and gotargs (byte-compile-warning-enabled-p 'callargs))
+         (byte-compile-arglist-warn fn (car args) nil)
+       (setq byte-compile-unresolved-functions
+             (delq unresolved byte-compile-unresolved-functions))))
+    (push (cons fn (if gotargs
+                      (list 'declared (car args))
+                    t))                     ; Arglist not specified.
+         byte-compile-function-environment))
   ;; We are stating that it _will_ be defined at runtime.
   (setq byte-compile-noruntime-functions
         (delq fn byte-compile-noruntime-functions))