[Top][All Lists]

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

bug#9448: 24.0.50; Comments in Awk scripts not fontified with comment fa

From: Alan Mackenzie
Subject: bug#9448: 24.0.50; Comments in Awk scripts not fontified with comment face
Date: Wed, 7 Sep 2011 18:14:29 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, all.

On Wed, Sep 07, 2011 at 05:01:47PM +0000, Alan Mackenzie wrote:

> >  emacs -Q
> >  C-x C-f foo.awk RET

> > Type "# something" (without quotes).  The comment is not highlighted
> > in the font-lock-comment face, as expected.  comment-start and
> > comment-start-skip seem to have reasonable values.

> A bit of binary chopping shows that the bug first became visible after
> this change:

>   revno: 104401
>   committer: Chong Yidong <address@hidden>
>   branch nick: trunk
>   timestamp: Sat 2011-05-28 13:16:54 -0400
>   message:
>     Make CC modes inherit from prog-mode.

>     * lisp/progmodes/cc-mode.el (c-mode, c++-mode, objc-mode, java-mode)
>     (idl-mode, pike-mode, awk-mode): Inherit from prog-mode.

> I cannot see anything in the change with looks remotely suspicious,
> however.  Except, of course, that AWK Mode is now constructed by a macro
> of some complexity, doubly invoked.

I think I see the problem, it's with the macro `define-derived-mode'.
This creates an empty syntax table with (defvar awk-mode-syntax-table),
and does this before cc-awk.elc has been loaded.  This thus stuffs the
proper definition of awk-mode-syntax-table.

Because of this, ?# doesn't have the open-comment syntax flag, thus
comments can't get fontified.

If I'm right about this, a solution would be to insert

   (makunbound 'awk-mode-syntax-table)
at the top of the mode initialisation.  Why on earth does
`define-derived-mode' have the temerity to create an empty, thus useless,
syntax table?  Maybe this should be taken out of the macro.

> Deleting cc-fonts.elc (thus allowing cc-fonts.el to be loaded) gets
> fontification of AWK comments working for me, too.

I still don't have a clue why this is happening.

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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