help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Trouble with quotes in comments for mode derived from sql-mode


From: David Hansen
Subject: Re: Trouble with quotes in comments for mode derived from sql-mode
Date: Fri, 20 Jan 2006 16:05:34 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

On 19 Jan 2006 06:20:41 -0800 colin wrote:

> Hello,
>
> I've written a very simple derived mode 'isq' mode which
> adds c++ style comments to sql-mode. The problem am having
> is unbalanced quotes in comments mess up string
> highlighting. I've seen similar problems in this group but
> haven't found a solution.
>
> Here's my derived mode:
>
> (define-derived-mode isq-mode sql-mode "ISQ" "Major mode to edit Sybase
> ISQ files."
>   (setq indent-tabs-mode nil)
>   (setq comment-start "// ")
> )

You have to modify the syntax table otherwise the syntax
parser will treat quotes within "comments" as the start of a
string.

> (font-lock-add-keywords 'isq-mode '(("\\(--.*\\|//.*\\)$" (0
> 'font-lock-comment-face t))))

And then you don't need this anymore as the syntax pass of
font-lock already highlights strings and comments.

David


reply via email to

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