GNU bug report logs - #11847
24.1.50; Error: Don't know how to compile #[nil "..."]

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Tue, 3 Jul 2012 03:34:01 UTC

Severity: normal

Found in version 24.1.50

Done: Chong Yidong <cyd <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 11847 in the body.
You can then email your comments to 11847 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 bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 03 Jul 2012 03:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 03 Jul 2012 03:34:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Mon, 2 Jul 2012 20:28:45 -0700
Started up the latest Windows binary, with my setup (not emacs -Q), and
immediately was presented with multiple "Error: Don't know how to
compile #[...]" messages in buffer `*Compile Log*.

The buffer is 161185 chars long (most of them binary, not printable
except as control chars, but some of the text seems to be from doc
strings).  That's 1154 very long lines.
 
Something seems very rotten in the State of Emacs.  It needs to calm
down, methinks.
 
My startup sequence loads some libraries, but it does not try to compile
anything.
 

In GNU Emacs 24.1.50.1 (i386-mingw-nt5.1.2600)
 of 2012-07-01 on MARVIN
Bzr revision: 108826 yamaoka <at> jpl.org-20120702004841-kzatmydft6dct0ry
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --no-opt --enable-checking --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 03 Jul 2012 06:18:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <11847 <at> debbugs.gnu.org>
Subject: RE: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Mon, 2 Jul 2012 23:12:57 -0700
> My startup sequence loads some libraries, but it does not try 
> to compile anything.

I take back that last part.  I do this kind of thing - but it is nothing new
(has always worked before):

(defcustom icicle-byte-compile-eval-after-load-flag t
  "*Non-nil means byte-compile definitions made within `eval-after-load'.
Some Icicles functions (commands, in particular) work only if a given
library is loaded.  Some such functions are defined inside an
`eval-after-load' form, which means they are defined only, and as soon
as, the required library is loaded.

If this option is non-nil then those function definitions are
byte-compiled.  This compilation adds a bit to the load time, in
effect, but it means that the functions run faster."
  :type 'boolean :group 'Icicles-Miscellaneous)

(defmacro icicle-maybe-byte-compile-after-load (function)
  "Byte-compile FUNCTION if `icicle-byte-compile-eval-after-load-flag'.
Do nothing if FUNCTION has not been defined (`fboundp')."
  `(when (and icicle-byte-compile-eval-after-load-flag (fboundp ',function))
    (require 'bytecomp)
    (let ((byte-compile-warnings  ())
          (byte-compile-verbose   nil))
      (byte-compile ',function))))

(defun icicle-cmd2-after-load-bookmark+ ()
  "Things to do for `icicles-cmd2.el' after loading `bookmark+.el'."
  (icicle-define-file-command icicle-bookmark-a-file ...)
  (icicle-maybe-byte-compile-after-load icicle-bookmark-a-file)
  ... ;; Etc. - more defs followed by maybe byte-compiling them.
  )

(eval-after-load "bookmark+" '(icicle-cmd2-after-load-bookmark+))

Where is the problem?  Why does Emacs now raise a runtime error?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 03 Jul 2012 06:27:01 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <11847 <at> debbugs.gnu.org>
Subject: RE: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Mon, 2 Jul 2012 23:21:27 -0700
> such functions are defined inside an
> `eval-after-load' form, which means they are defined
> only, and as soon as, the required library is loaded.
> 
> If this option is non-nil then those function
> definitions are byte-compiled.

The error looks like Emacs is trying to byte-compile byte-compiled code.  So I
wonder: is a defun inside an eval-after-load byte-compiled when the file is
byte-compiled?

I was under the impression that it was not, hence the micmac.  If it is, then
presumably I can get rid of the option and explicit byte-compilation.  But if
this is the case, is it the case in older Emacs versions also?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 03 Jul 2012 13:48:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 11847 <at> debbugs.gnu.org
Subject: Re: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Tue, 03 Jul 2012 09:42:22 -0400
> Started up the latest Windows binary, with my setup (not emacs -Q), and
> immediately was presented with multiple "Error: Don't know how to
> compile #[...]" messages in buffer `*Compile Log*.

Please set debug-on-error and byte-compile-debug to t to try and get
a backtrace for it.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 03 Jul 2012 14:50:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 11847 <at> debbugs.gnu.org
Subject: RE: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Tue, 3 Jul 2012 07:44:24 -0700
[Message part 1 (text/plain, inline)]
> Please set debug-on-error and byte-compile-debug to t to try and get
> a backtrace for it.

Attached.

But please see my other replies, where I acknowledge that my code does call
`byte-compile'.  See the question there about whether byte-compiling a Lisp file
also compiles a sexp (e.g. a defun) inside `eval-after-load' (and if so whether
that is true in older Emacs versions also).
[throw-bug-11847.txt (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 03 Jul 2012 17:32:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 11847 <at> debbugs.gnu.org
Subject: Re: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Tue, 03 Jul 2012 13:26:20 -0400
> But please see my other replies, where I acknowledge that my code does
> call `byte-compile'.  See the question there about whether
> byte-compiling a Lisp file also compiles a sexp (e.g. a defun) inside
> `eval-after-load'.

Byte-compilation is not done within quoted forms (i.e. forms that start
with '), so byte-compilation normally is not done on the code passed to
eval-after-load since that code is usually quoted.

> (and if so whether that is true in older Emacs versions also)

Yes, there has not been any change in this regard.  What has changed is
that byte-compile now complains when it can't do its job, whereas it
used to silently just return nil without doing anything.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 03 Jul 2012 18:05:01 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 11847 <at> debbugs.gnu.org
Subject: RE: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Tue, 3 Jul 2012 11:00:03 -0700
 
> Byte-compilation is not done within quoted forms (i.e. forms 
> that start with '), so byte-compilation normally is not done
> on the code passed to eval-after-load since that code is
> usually quoted.

That's what I thought.  Which means that I still need that code to let Icicles
users optionally byte-compile the defuns in the `eval-after-load' contexts.

> > (and if so whether that is true in older Emacs versions also)
> 
> Yes, there has not been any change in this regard.  What has 
> changed is that byte-compile now complains when it can't do
> its job, whereas it used to silently just return nil without
> doing anything.

I guess the bug has to do with why it thinks it cannot do its job here.  Unless
there is some bug in my code that makes compilation impossible where it should
otherwise be possible.  Can you tell by looking at the code I sent?  Or do you
think there is a byte-compiler bug here?

Since older byte-compiler versions apparently were silent when they could not
compile, I don't know whether they were able to compile or not in this context.

Hence the value of the new error.  But I wonder whether it shouldn't be (perhaps
it already is?) configurable: e.g., ignore, warning message only, raise error.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Thu, 05 Jul 2012 15:55:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 11847 <at> debbugs.gnu.org
Subject: RE: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Thu, 5 Jul 2012 08:49:22 -0700
ping. 

> I guess the bug has to do with why it thinks it cannot do its 
> job here.  Unless there is some bug in my code that makes
> compilation impossible where it should otherwise be possible.
> Can you tell by looking at the code I sent?  Or do you
> think there is a byte-compiler bug here?

There was a similar bug report (#11837), which was closed after finding a
font-latex bug.  I don't know how to proceed with this bug.  I sent the
backtrace you requested.

One thing I wonder about, which might be pertinent here:

Function `icicle-cmd2-after-load-bookmark+' is invoked after Bookmark+ is
loaded:

(eval-after-load "bookmark+" '(icicle-cmd2-after-load-bookmark+))

That function does this:

(icicle-define-file-command 'icicle-bookmark-a-file...)

And `icicle-define-file-command' is a macro that is not available at runtime.
It was available at byte-compile time, so I was thinking that it would be
expanded in the body of `icicle-cmd2-after-load-bookmark+', and things would be
OK.

(And things did work OK before the Emacs 24 build of this bug report, since the
byte-compiler ignored some errors that apparently did not cause a problem for
this code.)

It is `icicle-cmd2-after-load-bookmark+' that tries to byte-compile
`icicle-bookmark-a-file' after defining it.

Does this info help?  I want to avoid loading the file of macros at runtime.
And I want to avoid defining `icicle-bookmark-a-file' and other bookmark
commands unless Bookmark+ is loaded.

Please advise.  Thx.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Thu, 05 Jul 2012 16:20:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 11847 <at> debbugs.gnu.org
Subject: Re: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Thu, 05 Jul 2012 12:14:09 -0400
> ping. 

AFAIK your problem should be fixed in trunk now.


        Stefan


>> I guess the bug has to do with why it thinks it cannot do its 
>> job here.  Unless there is some bug in my code that makes
>> compilation impossible where it should otherwise be possible.
>> Can you tell by looking at the code I sent?  Or do you
>> think there is a byte-compiler bug here?

> There was a similar bug report (#11837), which was closed after finding a
> font-latex bug.  I don't know how to proceed with this bug.  I sent the
> backtrace you requested.

> One thing I wonder about, which might be pertinent here:

> Function `icicle-cmd2-after-load-bookmark+' is invoked after Bookmark+ is
> loaded:

> (eval-after-load "bookmark+" '(icicle-cmd2-after-load-bookmark+))

> That function does this:

> (icicle-define-file-command 'icicle-bookmark-a-file...)

> And `icicle-define-file-command' is a macro that is not available at runtime.
> It was available at byte-compile time, so I was thinking that it would be
> expanded in the body of `icicle-cmd2-after-load-bookmark+', and things would be
> OK.

> (And things did work OK before the Emacs 24 build of this bug report, since the
> byte-compiler ignored some errors that apparently did not cause a problem for
> this code.)

> It is `icicle-cmd2-after-load-bookmark+' that tries to byte-compile
> `icicle-bookmark-a-file' after defining it.

> Does this info help?  I want to avoid loading the file of macros at runtime.
> And I want to avoid defining `icicle-bookmark-a-file' and other bookmark
> commands unless Bookmark+ is loaded.

> Please advise.  Thx.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Thu, 05 Jul 2012 16:26:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 11847 <at> debbugs.gnu.org
Subject: RE: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Thu, 5 Jul 2012 09:20:58 -0700
> AFAIK your problem should be fixed in trunk now.

Excellent.  I'll give it a try with the next Windows build and let you know.
Thx.





bug closed, send any further explanations to 11847 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 17 Jul 2012 04:34:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 17 Jul 2012 05:57:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 11847 <at> debbugs.gnu.org
Subject: RE: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Mon, 16 Jul 2012 22:50:16 -0700
> > Byte-compilation is not done within quoted forms (i.e. forms 
> > that start with '), so byte-compilation normally is not done
> > on the code passed to eval-after-load since that code is
> > usually quoted.
> 
> That's what I thought.  Which means that I still need that 
> code to let Icicles users optionally byte-compile the defuns
> in the `eval-after-load' contexts.

Or maybe not?  In the latest Windows build, from today (7/16), I'm seeing these
(new) messages during loading:

Function icicle-bookmark-a-file is already compiled
Function icicle-tag-a-file is already compiled
Function icicle-untag-a-file is already compiled
Function icicle-find-file-tagged is already compiled
etc.

Those are the functions that I was worried would not be compiled and so called
explicitly for their compilation.  Now I wonder.

So I guess I'm still not understanding.  I byte-compile the source file, which
has this kind of thing:

(defun icicle-cmd2-after-load-bookmark+ ()
  (icicle-define-file-command icicle-bookmark-a-file ...)
  (icicle-maybe-byte-compile-after-load icicle-bookmark-a-file)
  ... ; more of the same: function defs followed by calls to compile
)
(eval-after-load "bookmark+" '(icicle-cmd2-after-load-bookmark+))

`icicle-define-file-command' is a macro defined in a file available at compile
time.  It expands to a defun (e.g. that defines function
`icicle-bookmark-a-file' here).

`icicle-maybe-byte-compile-after-load' is this simple macro:

(defmacro icicle-maybe-byte-compile-after-load (function)
  `(when (and icicle-byte-compile-eval-after-load-flag (fboundp ',function))
    (require 'bytecomp)
    (let ((byte-compile-warnings  ())
          (byte-compile-verbose   nil))
      (byte-compile ',function))))

(Now that I look at that again I notice that that macro could/should just be a
function.  Dunno why I made it a macro.)

Do those messages indicate that the functions in question were already compiled
in the .elc where they are defined inside `icicle-cmd2-after-load-bookmark+'?

Looking at your previous response, it seems to suggest only that the _call_ to
`icicle-cmd2-after-load-bookmark+' would not be byte-compiled, because it is
quoted.  But the defuns (via the macro) that are in the body of
`icicle-cmd2-after-load-bookmark+': are they byte-compiled in the .elc where
`icicle-cmd2-after-load-bookmark+' is defined?  I was afraid they would not be,
but the messages seem to indicate that they are.

IOW, given those messages, I'm wondering again whether I really need the
(user-optional) calls to `icicle-maybe-byte-compile-after-load'.  I was
supposing that I needed them because the definitions are inside an
`eval-after-load' (with a quoted sexp, as you mentioned).

> > > (and if so whether that is true in older Emacs versions also)
> > 
> > Yes, there has not been any change in this regard.  What has 
> > changed is that byte-compile now complains when it can't do
> > its job, whereas it used to silently just return nil without
> > doing anything.
> 
> I guess the bug has to do with why it thinks it cannot do its 
> job here.  Unless there is some bug in my code that makes compilation 
> impossible where it should otherwise be possible.  Can you tell by
> looking at the code I sent?  Or do you think there is a byte-compiler
> bug here?

Since the bug is no longer manifested, now I'm guessing that it was previously
complaining that it could not compile only because the target was already
compiled.  Is that the case?

I'd be glad to get rid of the micmac of using
`icicle-maybe-byte-compile-after-load', if I understood that it did not actually
do anything worthwhile.  Looking for some understanding of this.  Thx.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 17 Jul 2012 06:03:01 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 11847 <at> debbugs.gnu.org
Subject: RE: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Mon, 16 Jul 2012 22:56:17 -0700
> > AFAIK your problem should be fixed in trunk now.
> 
> Excellent.  I'll give it a try with the next Windows build 
> and let you know.  Thx.

Confirmed - I no longer get the error messages.  However, please see my followup
question about needed to byte-compile.  Now I'm getting messages saying that the
functions are already compiled.  Thx.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 17 Jul 2012 06:44:03 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 11847 <at> debbugs.gnu.org
Subject: Re: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Tue, 17 Jul 2012 02:37:35 -0400
> Looking at your previous response, it seems to suggest only that the
> _call_ to `icicle-cmd2-after-load-bookmark+' would not be
> byte-compiled, because it is quoted.

Indeed.  Compilation looks at the text, not at the dynamic call-tree, so
the code that's not textually inside a ' will be compiled just fine.

> But the defuns (via the macro) that are in the body of
> `icicle-cmd2-after-load-bookmark+': are they byte-compiled in the .elc
> where `icicle-cmd2-after-load-bookmark+' is defined?

Of course.

> IOW, given those messages, I'm wondering again whether I really need the
> (user-optional) calls to `icicle-maybe-byte-compile-after-load'.  I was
> supposing that I needed them because the definitions are inside an
> `eval-after-load' (with a quoted sexp, as you mentioned).

No, the definitions are not inside an eval-after-load.  They are
*evaluated* from an eval-after-load, but they are not *located*
inside it.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11847; Package emacs. (Tue, 17 Jul 2012 06:47:01 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 11847 <at> debbugs.gnu.org
Subject: RE: bug#11847: 24.1.50; Error: Don't know how to compile #[nil "..."]
Date: Mon, 16 Jul 2012 23:40:16 -0700
> the definitions are not inside an eval-after-load.  They are
> *evaluated* from an eval-after-load, but they are not *located*
> inside it.

That's what I wanted to hear.  Thanks.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 14 Aug 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 7 days ago.

Previous Next


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