From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Hansen Newsgroups: gmane.emacs.help Subject: Re: Trouble with quotes in comments for mode derived from sql-mode Date: Fri, 20 Jan 2006 16:05:34 +0100 Organization: disorganized Message-ID: <87slrjhrcx.fsf@robotron.kosmorama> References: <1137680440.990855.5430@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1137788882 29881 80.91.229.2 (20 Jan 2006 20:28:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2006 20:28:02 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 20 21:27:59 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F02qN-0006I2-9C for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Jan 2006 21:26:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F02Iv-0000DE-Kx for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Jan 2006 14:52:13 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 29 Original-X-Trace: news.uni-berlin.de +FEVgD76LK7GYkA6gEzwKw5z2mLdJHUMHcs2k8+l9d8A== X-Orig-Path: robotron.ath.cx!news Mail-Copies-To: nobody User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:su3dGDhkUIhnfO/R9CJ7lDClnzw= Original-Xref: shelby.stanford.edu gnu.emacs.help:137131 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:32753 Archived-At: 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