error "`c-lang-defconst' when nXhtml is compiled

Bug #619629 reported by jess
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
nXhtml
In Progress
Medium
Unassigned

Bug Description

I am running GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.3) and xhtml was working fine until I compiled it via the menu nXhtml -> nXhtml Help and Setup -> Byte Compile nXhtml. Now when opening .php files I am getting error "`c-lang-defconst'- must be used in a file".

My .emacs uses:
(load "~/.site-lisp/nxhtml/autostart.el")

The issue seems to be a problem with php-mode.el described here: http://stackoverflow.com/questions/898063/making-php-mode-compatible-with-emacs-23

Here is the complete backtrace:
Debugger entered--Lisp error: (error "`c-lang-defconst'- must be used in a file")
  signal(error ("`c-lang-defconst' must be used in a file"))
  error("`c-lang-defconst' must be used in a file")
  c-define-lang-constant(c-mode-menu ((t cons ["Comment Out Region" comment-region ...] (cons ["Uncomment Region" ... ...] ...))))
  require(cc-langs)
  byte-code("ÀÁ!ÀÂ!ÀÃ!ÀÄ!ÀÅ!ÀÆ!ÀÇ!ÈÉÊËÌÍÎÏ&" [require add-log speedbar font-lock cc-mode cc-langs custom etags custom-declare-group php nil "Major mode `php-mode' for editing PHP code." :prefix "php-" :group languages] 8)
  php-mode()
  mumamo-fetch-major-mode-setup(php-mode nil nil nil nil)
  mumamo-get-major-mode-setup(php-mode)
  mumamo-end-in-code(6 485 php-mode)
  mumamo-find-next-chunk-values(#<overlay from 1 to 1 in index.php> nil nil nil)
  mumamo-find-chunks-1(1 "mumamo-turn-on-actions")
  mumamo-find-chunks(1 "mumamo-turn-on-actions")
  mumamo-turn-on-actions(fundamental-mode)
  nxhtml-mumamo-mode()
  set-auto-mode-0(nxhtml-mumamo-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer index.php> "~/work/grokcode/redesign2010/wordpress/wp-content/themes/twentyten/index.php" nil nil "~/work/grokcode/redesign2010/wordpress/wp-content/themes/twentyten/index.php" (2237325 2053))
  find-file-noselect("/home/smudge/work/grokcode/redesign2010/wordpress/wp-content/themes/twentyten/index.php" nil nil nil)
  find-file("/home/smudge/work/grokcode/redesign2010/wordpress/wp-content/themes/twentyten/index.php")
  command-line-1(("index.php"))
  command-line()
  normal-top-level()

Revision history for this message
lborgman (lennart-borgman) wrote :

Thanks jess,

I have mailed the Emacs c mode maintainer and asked for some advice for how to fix this.

Changed in nxhtml:
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Alan Mackenzie (acm-muc) wrote : Re: Fwd: [Bug 619629] [NEW] error "`c-lang-defconst' when nXhtml is compiled
Download full text (6.0 KiB)

On Wed, Aug 17, 2010 at 12:40:29PM +0200, Lennart Borgman wrote:
> Hi Alan,

> Do you have any idea of how this can be handled?

Hmm. The error message comes from `c-define-lang-constant' (cc-defs.el)
which is purely a compile time function. That is, it's called only from
the macro c-lang-defconst, and doesn't even appear in the compiled CC
Mode, the bit that gets loaded. cc-langs.el should NEVER be `require'd
at runtime.

So, either CC Mode's definition and handling of this macro are buggy, or
somebody (quite a few of them) are building the derived modes in a
suboptimal fashion. Looking at the backtrace below, it seems that
c-define-lang-constant is being called (probably via c-lang-defconst) at
runtime. This is not a Good Thing to do. "lang consts" are constants
whose values vary between C, C++, Java, Objective C, .......PHP, C#.
They are created completely at build time.

If I'm right, then the maintainer of PHP Mode should rethink this
non-standard and unforseen use of `c-lang-defconst'.

Questions to <email address hidden> on this topic will get answered. ;-)

It would probably be a Good Thing for all this to be better documented
somewhere.

> Best wishes,
> L

--
Alan Mackenzie (Nuremberg, Germany).

> ---------- Forwarded message ----------
> From: jess <email address hidden>
> Date: Wed, Aug 18, 2010 at 7:05 AM
> Subject: [Bug 619629] [NEW] error "`c-lang-defconst' when nXhtml is compiled
> To: <email address hidden>

> Public bug reported:

> I am running GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.3)
> and xhtml was working fine until I compiled it via the menu nXhtml ->
> nXhtml Help and Setup -> Byte Compile nXhtml.  Now when opening .php
> files I am getting error "`c-lang-defconst'- must be used in a file".

> My .emacs uses:
> (load "~/.site-lisp/nxhtml/autostart.el")

> The issue seems to be a problem with php-mode.el described here:
> http://stackoverflow.com/questions/898063/making-php-mode-compatible-
> with-emacs-23

> Here is the complete backtrace:
> Debugger entered--Lisp error: (error "`c-lang-defconst'- must be used
> in a file")
>  signal(error ("`c-lang-defconst' must be used in a file"))
>  error("`c-lang-defconst' must be used in a file")
>  c-define-lang-constant(c-mode-menu ((t cons ["Comment Out Region"
> comment-region ...] (cons ["Uncomment Region" ... ...] ...))))
>  require(cc-langs)
>  byte-code("ÀÁ!ÀÂ!ÀÃ!ÀÄ!ÀÅ!ÀÆ!ÀÇ!ÈÉÊËÌÍÎÏ& " [require add-log speedbar
> font-lock cc-mode cc-langs custom etags custom-declare-group php nil
> "Major mode `php-mode' for editing PHP code." :prefix "php-" :group
> languages] 8)
>  php-mode()
>  mumamo-fetch-major-mode-setup(php-mode nil nil nil nil)
>  mumamo-get-major-mode-setup(php-mode)
>  mumamo-end-in-code(6 485 php-mode)
>  mumamo-find-next-chunk-values(#<overlay from 1 to 1 in index.php> nil nil nil)
>  mumamo-find-chunks-1(1 "mumamo-turn-on-actions")
>  mumamo-find-chunks(1 "mumamo-turn-on-actions")
>  mumamo-turn-on-actions(fundamental-mode)
>  nxhtml-mumamo-mode()
>  set-auto-mode-0(nxhtml-mumamo-mode nil)
>  set-auto-mode()
>  normal-mode(t)
>  after-find-file(nil t)
>  find-file-noselect-1(#<buffer index.php>
> "~/work/grokcode/redesign...

Read more...

Revision history for this message
lborgman (lennart-borgman) wrote : Re: Fwd: [Bug 619629] [NEW] error "`c-lang-defconst' when nXhtml is compiled
Download full text (6.4 KiB)

Hi Aaron,

What do you think about this? In the version of php-mode.el there is a line

   (require 'cc-langs)

which Alan says is no good.

- L

On Fri, Aug 20, 2010 at 11:36 PM, Alan Mackenzie <email address hidden> wrote:
> On Wed, Aug 17, 2010 at 12:40:29PM +0200, Lennart Borgman wrote:
>> Hi Alan,
>
>> Do you have any idea of how this can be handled?
>
> Hmm.  The error message comes from `c-define-lang-constant' (cc-defs.el)
> which is purely a compile time function.  That is, it's called only from
> the macro c-lang-defconst, and doesn't even appear in the compiled CC
> Mode, the bit that gets loaded.  cc-langs.el should NEVER be `require'd
> at runtime.
>
> So, either CC Mode's definition and handling of this macro are buggy, or
> somebody (quite a few of them) are building the derived modes in a
> suboptimal fashion.  Looking at the backtrace below, it seems that
> c-define-lang-constant is being called (probably via c-lang-defconst) at
> runtime.  This is not a Good Thing to do.  "lang consts" are constants
> whose values vary between C, C++, Java, Objective C, .......PHP, C#.
> They are created completely at build time.
>
> If I'm right, then the maintainer of PHP Mode should rethink this
> non-standard and unforseen use of `c-lang-defconst'.
>
> Questions to <email address hidden> on this topic will get answered.  ;-)
>
> It would probably be a Good Thing for all this to be better documented
> somewhere.
>
>> Best wishes,
>> L
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>
>
>> ---------- Forwarded message ----------
>> From: jess <email address hidden>
>> Date: Wed, Aug 18, 2010 at 7:05 AM
>> Subject: [Bug 619629] [NEW] error "`c-lang-defconst' when nXhtml is compiled
>> To: <email address hidden>
>
>
>> Public bug reported:
>
>> I am running GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.3)
>> and xhtml was working fine until I compiled it via the menu nXhtml ->
>> nXhtml Help and Setup -> Byte Compile nXhtml.  Now when opening .php
>> files I am getting error "`c-lang-defconst'- must be used in a file".
>
>> My .emacs uses:
>> (load "~/.site-lisp/nxhtml/autostart.el")
>
>> The issue seems to be a problem with php-mode.el described here:
>> http://stackoverflow.com/questions/898063/making-php-mode-compatible-
>> with-emacs-23
>
>> Here is the complete backtrace:
>> Debugger entered--Lisp error: (error "`c-lang-defconst'- must be used
>> in a file")
>>  signal(error ("`c-lang-defconst' must be used in a file"))
>>  error("`c-lang-defconst' must be used in a file")
>>  c-define-lang-constant(c-mode-menu ((t cons ["Comment Out Region"
>> comment-region ...] (cons ["Uncomment Region" ... ...] ...))))
>>  require(cc-langs)
>>  byte-code("АБ!АВ!АГ!АД!АЕ!АЖ!АЗ!ИЙКЛМНОП& " [require add-log speedbar
>> font-lock cc-mode cc-langs custom etags custom-declare-group php nil
>> "Major mode `php-mode' for editing PHP code." :prefix "php-" :group
>> languages] 8)
>>  php-mode()
>>  mumamo-fetch-major-mode-setup(php-mode nil nil nil nil)
>>  mumamo-get-major-mode-setup(php-mode)
>>  mumamo-end-in-code(6 485 php-mode)
>>  mumamo-find-next-chunk-values(#<overlay from 1 to 1 in index.php> nil nil nil)
>>  mumamo-find-chunks-1(1 "mumamo-turn-...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.