emacs-devel
[Top][All Lists]
Advanced

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

Re: comment-start redefined in cc-langs.el


From: Alan Mackenzie
Subject: Re: comment-start redefined in cc-langs.el
Date: Fri, 21 Jul 2006 23:52:12 +0100
User-agent: Mutt/1.5.9i

'Evening, Martin!

On Fri, Jul 21, 2006 at 06:05:54PM +0200, martin rudalics wrote:

[ .... ]

> >OK, here is a patch.

> >Basically, the declarations like (c-lang-defvar comment-start ....)
> >(in cc-langs.el ~L1131) were causing forms (defvar comment-start ...)
> >to get generated in cc-engine.el (via the macro
> >c-declare-lang-variables).

> >I have added the macro c-lang-setvar which does all the fancy stuff
> >that c-lang-defvar does, only without generating the defvar.

> >Please let me know if there are any problems with this patch.

> Good evening, Alan!

> I'm afraid the patch doesn't change a thing in the behavior of my
> Emacs.  Would I have to do anything else but patch&recompile these two
> files?

Sorry!  I should have given you a recipe here, since there's a rather
intricate chain of macros involved.  In particular, cc-engine.elc must be
recompiled, since this contains the spurious (defvar comment-start).  It
is perhaps better to clear out the old cc-*.elc and recompile them all
fresh:

  $ cd .../emacs/lisp/progmodes
  $ rm cc-*.elc
  $ emacs -batch -no-site-file -q -f batch-byte-compile cc-*.el

> Anyway, if I look at `load-history', the definitions from cc-engine.elc
> still precede textually those from newcomment.elc, doesn't that come
> from (c-lang-defconst comment-start ... ?

No, not directly.  c-lang-defconst defines (or sets) a symbol in the
obarray `c-lang-constants', and has no effect outside of that obarray.
It is c-lang-defvar which (indirectly) (!used to) redefine
`comment-start', thusly:

(c-lang-defvar c-assignment-op-regexp) collects information from the
aforementioned obarray `c-lang-constants', and dumps it into the list
`c-lang-variable-inits'.  This is later used:

(i) in cc-engine.el, where macro `c-declare-lang-variables' generates
    (defvar c-assignment-op-regexp)
    (make-variable-buffer-local 'c-assignment-op-regexp)
(ii) in macro `c-init-language-vars' (called from cc-mode.el), where an
    appropriate lisp form for one of the seven languages (C, C++, ...) is
    dumped into a setq.  e.g., for C:
    (setq c-assignment-op-regexp
          "=\\([^=]\\|$\\)\\|\\(?:<<\\|>>\\|[%&*+/|^-]\\)=")

One of my high priority TODOs is to document this mechanism more clearly
in the source files (probably in cc-langs.el).

Would you please try this again after recompiling cc-*.el.  Thanks!

> martin

-- 
Alan.





reply via email to

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