Subject: bug#8647: since lexical merge, declare-function in subr.el no longer works

From: Glenn Morris <[email-masked]>
Date: Wed, 11 May 2011 14:12:48 -0400

Moving the definition to the end of subr.el does not work, because
subr.el is loaded uncompiled during bootstrap.

IMO, conceptually the right fix is for an element in
byte-compile-initial-macro-environment to _always_ take precedence
during compilation, even if the file being compiled contains a
redefinition.

*** lisp/emacs-lisp/bytecomp.el	2011-05-11 17:32:38 +0000
--- lisp/emacs-lisp/bytecomp.el	2011-05-11 17:57:12 +0000
***************
*** 2166,2172 ****
  	      byte-compile-output nil))))
  
  (defun byte-compile-preprocess (form &optional _for-effect)
!   (setq form (macroexpand-all form byte-compile-macro-environment))
    ;; FIXME: We should run byte-optimize-form here, but it currently does not
    ;; recurse through all the code, so we'd have to fix this first.
    ;; Maybe a good fix would be to merge byte-optimize-form into
--- 2174,2183 ----
  	      byte-compile-output nil))))
  
  (defun byte-compile-preprocess (form &optional _for-effect)
!   ;; b-c-initial-m-e should take precedence during compilation.  (Bug#8647)
!   (setq form (macroexpand-all form
! 			      (append byte-compile-initial-macro-environment
! 				      byte-compile-macro-environment)))
    ;; FIXME: We should run byte-optimize-form here, but it currently does not
    ;; recurse through all the code, so we'd have to fix this first.
    ;; Maybe a good fix would be to merge byte-optimize-form into