From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rgb Newsgroups: gmane.emacs.help Subject: Re: how do I have a mode where '#' is a comment but '.#.' isn't? Date: Wed, 24 Dec 2008 09:42:32 -0800 (PST) Organization: http://groups.google.com Message-ID: <23da89fc-338e-4e3c-a3ea-998ec13dfb69@r36g2000prf.googlegroups.com> References: <5fd737ce-449e-4da0-bd54-a467d23faef2@w39g2000prb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1230144079 7599 80.91.229.12 (24 Dec 2008 18:41:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Dec 2008 18:41:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 24 19:42:25 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LFYg7-0002le-Jz for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Dec 2008 19:41:55 +0100 Original-Received: from localhost ([127.0.0.1]:52924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LFYeu-0006mQ-KH for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Dec 2008 13:40:40 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!r36g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 47 Original-NNTP-Posting-Host: 159.136.224.13 Original-X-Trace: posting.google.com 1230140553 13233 127.0.0.1 (24 Dec 2008 17:42:33 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 24 Dec 2008 17:42:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r36g2000prf.googlegroups.com; posting-host=159.136.224.13; posting-account=c0t8LgoAAAAU6L5wu8lL6g4rkWKIgySB User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 plsprox6.bcbsmn.com:9119 (squid/2.5.STABLE14) Original-Xref: news.stanford.edu gnu.emacs.help:165588 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:60920 Archived-At: I've had similar problems with several major modes I've written. Cobol for example doesn't even have a comment character, anything after a particular column is a comment TAL uses ! as both begin and end and eol is also an implicit end.... So ! this is a comment!but this isn't! and this is but this isn't Anyway, the only really good way to get useful results is by specifying font-lock-syntactic-keywords in your font-lock-defaults statement. It's not a terribly simple process. Some years ago, when I was writing all those modes, I was pretty fluent and could spout off just exactly how to do it. Fortunately I answered several how-to questions in several Emacs NGs so my notes are available. Try this thread. I think it's pretty complete in covering what you need to know. http://groups.google.com/group/comp.emacs/browse_thread/thread/c1b7de4489be181 stuart wrote: > I have been working on a mode for a program where a hash mark by > itself is a comment character (#) whereas a hash mark surrounded by > dots (.#.) is not. Currently, I'm using this: > > ;; Change the interpretation of particular chars in Emacs' syntax > table > (defvar fst-mode-syntax-table > (let ( (fst-mode-syntax-table (make-syntax-table) ) ) > (modify-syntax-entry ?# "<" fst-mode-syntax-table) ; start > comment > (modify-syntax-entry ?\n ">" fst-mode-syntax-table) ; end > comment > (modify-syntax-entry ?\\ "_" fst-mode-syntax-table) ; don't > escape quote > (modify-syntax-entry ?% "/" fst-mode-syntax-table) ; > functions as escape char > fst-mode-syntax-table ) > "Syntax table for fst-mode" ) > > But it doesn't do the right thing--i.e., it treats '.#.' as a dot > followed by a comment. Is there any easy fix here? Thanks in advance.