emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: M-x c-mode loads cl-macs, cl-seq, cl-extra


From: Alan Mackenzie
Subject: Re: M-x c-mode loads cl-macs, cl-seq, cl-extra
Date: Tue, 18 Apr 2006 21:07:22 +0000 (GMT)

[This is a copy of an email to RMS and bug-cc-mode that I meant to CC to
emacs-devel, but forgot.]

Hi, Richard!

On Sun, 9 Apr 2006, Richard Stallman wrote:

>I did   emacs -Q -f toggle-debug-on-error test.c
>and noticed it loaded the files cl-macs, cl-seq, cl-extra
>as well as bytecomp.  It should not load any of those files.

>How soon can you fix this?

This doesn't happen to me at home.  However, when I did

    # rm cc-langs.elc

followed by
    M-x byte-compile-file cc-mode.el
, then
    M-x byte-compile-file cc-langs.el

(in that order), cl-*.elc DO get loaded with c-mode.

Would you please try this:
(i) byte compile cc-mode.el WHILST CC-LANGS.ELC EXISTS.  Does this make
  the bug go away?
(ii) Then byte compile cc-mode.el WHILST cc-langs.ELC DOESN'T EXIST (and
  then recompile cc-langs.elc, of course).  Does the bug come back again?

My hypothesis is that it's the macro c-init-language-vars, called from
c-init-language-vars-for at mode initialisation time.  The core of macro
c-init-language-vars is  (defun c-make-init-lang-vars-fun (mode) ...),
which gets called either at byte-compile time or loading time, and which
builds a lamdba form, the "giant setq" for language constants.  This
macro generates different code depending on the context in which it gets
called.  (This is deliberate - it makes it easier to test changes to the
language constants, since much less code needs to be recompiled to
retest.)

If this is the case, the solution would be always to byte-compile
cc-langs.el (?and cc-fonts.el, maybe - I'll have to look at this) before
cc-mode.el.  This could, I believe, be achieved with a 1 byte patch in
..../lisp/Makefile.in like this:

*** Makefile.in Sun Feb 19 12:48:34 2006
--- Makefile.in.new     Tue Apr 18 12:53:10 2006
***************
*** 216,222 ****
  # version string in cc-defs.el.
  $(lisp)/progmodes/cc-mode.elc: \
        $(lisp)/progmodes/cc-mode.el \
!       $(lisp)/progmodes/cc-langs.el \
        $(lisp)/progmodes/cc-defs.el
        $(EMACS) $(EMACSOPT) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el
  
--- 216,222 ----
  # version string in cc-defs.el.
  $(lisp)/progmodes/cc-mode.elc: \
        $(lisp)/progmodes/cc-mode.el \
!       $(lisp)/progmodes/cc-langs.elc \
        $(lisp)/progmodes/cc-defs.el
        $(EMACS) $(EMACSOPT) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el
  
However, I haven't tried this out, yet.  (Rebuilding Emacs from scratch
is a 5 hour job for my beloved 166 MHz dinosaur.)

-- 
Alan.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]