unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8647: since lexical merge, declare-function in subr.el no longer works
@ 2011-05-10 22:29 Glenn Morris
  2011-05-11 18:12 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2011-05-10 22:29 UTC (permalink / raw)
  To: 8647

Package: emacs
Version: 24.0.50
Severity: minor

Since the merge of the lexical branch, `declare-function' statements in
subr.el no longer have the desired effect. Eg compiling subr.el warns:

In end of data:
subr.el:4015:1:Warning: the function `w32-shell-dos-semantics' is not
  known to be defined.

despite the presence of

  (declare-function w32-shell-dos-semantics "w32-fns" nil)

in the file.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8647: since lexical merge, declare-function in subr.el no longer works
  2011-05-10 22:29 bug#8647: since lexical merge, declare-function in subr.el no longer works Glenn Morris
@ 2011-05-11 18:12 ` Glenn Morris
  2011-05-12  1:02   ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2011-05-11 18:12 UTC (permalink / raw)
  To: 8647


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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8647: since lexical merge, declare-function in subr.el no longer works
  2011-05-11 18:12 ` Glenn Morris
@ 2011-05-12  1:02   ` Stefan Monnier
  2011-05-12  2:36     ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-05-12  1:02 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 8647

> 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.

Agreed.
Another way to get that result is to change the place where we add
elements to byte-compile-macro-environment (so as not to add it if it's
in byte-compile-initial-macro-environment), but the one you showed
seems fine.  Feel free to install it.


        Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8647: since lexical merge, declare-function in subr.el no longer works
  2011-05-12  1:02   ` Stefan Monnier
@ 2011-05-12  2:36     ` Glenn Morris
  0 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2011-05-12  2:36 UTC (permalink / raw)
  To: 8647-done

Stefan Monnier wrote:

> Another way to get that result is to change the place where we add
> elements to byte-compile-macro-environment (so as not to add it if it's
> in byte-compile-initial-macro-environment),

I like that idea better. Done.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-12  2:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10 22:29 bug#8647: since lexical merge, declare-function in subr.el no longer works Glenn Morris
2011-05-11 18:12 ` Glenn Morris
2011-05-12  1:02   ` Stefan Monnier
2011-05-12  2:36     ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).