GNU bug report logs - #8647
since lexical merge, declare-function in subr.el no longer works

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Tue, 10 May 2011 22:30:03 UTC

Severity: minor

Found in version 24.0.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8647 in the body.
You can then email your comments to 8647 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8647; Package emacs. (Tue, 10 May 2011 22:30:03 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: since lexical merge, declare-function in subr.el no longer works
Date: Tue, 10 May 2011 18:29:20 -0400
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.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8647; Package emacs. (Wed, 11 May 2011 18:13:02 GMT) Full text and rfc822 format available.

Message #6 received at 8647 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 8647 <at> debbugs.gnu.org
Subject: Re: bug#8647: since lexical merge,
	declare-function in subr.el no longer works
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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8647; Package emacs. (Thu, 12 May 2011 01:03:02 GMT) Full text and rfc822 format available.

Message #9 received at 8647 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 8647 <at> debbugs.gnu.org
Subject: Re: bug#8647: since lexical merge,
	declare-function in subr.el no longer works
Date: Wed, 11 May 2011 22:02:49 -0300
> 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




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 12 May 2011 02:37:01 GMT) Full text and rfc822 format available.

Notification sent to Glenn Morris <rgm <at> gnu.org>:
bug acknowledged by developer. (Thu, 12 May 2011 02:37:01 GMT) Full text and rfc822 format available.

Message #14 received at 8647-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 8647-done <at> debbugs.gnu.org
Subject: Re: bug#8647: since lexical merge,
	declare-function in subr.el no longer works
Date: Wed, 11 May 2011 22:36:43 -0400
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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 09 Jun 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 66 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.