From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: How to implement comments that always start at the beginning of a line Date: Tue, 24 Oct 2006 12:01:32 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1161708134 18644 80.91.229.2 (24 Oct 2006 16:42:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Oct 2006 16:42:14 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 24 18:42:11 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 1GcPKh-0005le-Ig for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Oct 2006 18:40:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GcPKg-00037L-V5 for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Oct 2006 12:40:55 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.umontreal.ca!news.umontreal.ca.POSTED!not-for-mail Original-NNTP-Posting-Date: Tue, 24 Oct 2006 11:01:32 -0500 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:rqk1qd+HkTAwuiHDODkPjjc7bQs= Original-Lines: 33 Original-NNTP-Posting-Host: 132.204.26.177 Original-X-Trace: sv3-0oixLbCJm+tZkZsZEo+C6b03ATcEdLiYk4B5hdW1a4QppSTQyPPT4l4FPtrYHfe+y/voWh6Vy++GX6w!F2qwk8S5Q9fEFWzK5mwVOw91i52sTRiOwKVQAWBSmxVItMoGr/E3aELTKPWbiNHKddzUgyfRD5lb!DvDYEhRbSvAdiIwwOQ== Original-X-Complaints-To: abuse@umontreal.ca X-DMCA-Complaints-To: abuse@umontreal.ca X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Original-Xref: shelby.stanford.edu gnu.emacs.help:142625 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:38248 Archived-At: > I'm writing my own Emacs major mode for a language in with all comments > start with an starisk at the beginning of a line. Unfortunately, I haven't > found a way to implement this in the syntax table. > I tried to do a two-character comment sequence, with the first character > being a newline and the 2nd character an asterisk. This would neglect > comments in the first line of a buffer, but it would be better than nothing. > The lines I used were > (modify-syntax-entry ?\n ">1" form-mode-syntax-table) > (modify-syntax-entry ?* ".2" form-mode-syntax-table) Firt, the syntax of the string passed as second argument treats the frst two chars specially, so the "1" and "2" need to be placed further: (modify-syntax-entry ?\n "> 1" form-mode-syntax-table) (modify-syntax-entry ?* ". 2" form-mode-syntax-table) but this likely won't work because this kind of mixing a close-comment with a begin-comment in the same char-sequence was not expected by the (latest) coder of the comment-handling code (i.e. myself). And even if I had expected it, it's not clear how I'd have interpreted it: /*/ in c-mode (and -- in snmp-mode) either closes or opens a comment, but not both. > but that didn't work the way I expected. Does anybody have an idea how to > solve this? font-lock-syntactic-keywords is the onl thing that springs to my mind. See fortran.el for an example. Stefan