From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: jyangstat@yahoo.com (jyangstat@yahoo.com) Newsgroups: gmane.emacs.help Subject: Re: Highlight comment in gauss mode Date: 6 Jan 2004 16:20:49 -0800 Organization: http://groups.google.com Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <65ef16d2.0401061620.4d7247db@posting.google.com> References: <65ef16d2.0401060700.3a9f8a6a@posting.google.com> NNTP-Posting-Host: deer.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1073435630 29574 80.91.224.253 (7 Jan 2004 00:33:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Jan 2004 00:33:50 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 07 01:33:44 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ae1do-0001zx-00 for ; Wed, 07 Jan 2004 01:33:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Ae2Yc-0006Sl-Lx for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Jan 2004 20:32:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews2.google.com!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 531 Original-NNTP-Posting-Host: 67.72.197.156 Original-X-Trace: posting.google.com 1073434849 9284 127.0.0.1 (7 Jan 2004 00:20:49 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 7 Jan 2004 00:20:49 +0000 (UTC) Original-Xref: shelby.stanford.edu gnu.emacs.help:119804 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:15747 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15747 Thank you for your response and sorry for unclear information. Based on Gauss, the valid comment format is anything between /* and */ (same as C) and between @ ... @ when @ ... @ is at the same line. I just use the gauss mode implemented by Steve Berry. However, this mode only supports @ ... @ type comment but not highlight the comment. The whole gauss mode is as follows. Could you help me modify the mode? Thanks a lot. James ;; -------------------------------------------------------------- ;; gauss-mode.el - major mode for editing Gauss programs with GNU Emacs ;; ;; This major mode for GNU Emacs provides support for editing Gauss ;; source files. It automatically indents for block structures, line ;; continuations (e.g., ...), and comments. The usual paren matching ;; support is included. ;; ;; In addition to automatic indentation when typing "do while" blocks, ;; "if" blocks, "proc" 's, etc., TAB indents an existing or new line to ;; the correct level and META-; sets up a comment line. META-return starts ;; a newline at column one, ignoring the automatic indentation. ;; To properly indent an existing region in a *.prg file, use the command ;; M-x indent-region. ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; To enter gauss-mode automatically when editing .prg files, put ;; something like this in your .emacs file. ;; ;; (autoload 'gauss-mode "gauss-mode" "Enter Gauss-mode." t) ;; (setq auto-mode-alist (cons '("\\.prg$" . gauss-mode) auto-mode-alist)) ;; (setq gauss-mode-hook '(lambda () (setq fill-column 74))) ;; ;; Enjoy. ;; ;; THIS FILE IS A COMPLETE HACK by Steve Berry (March 1994). It is ;; modified from octave-mode.el, which is modified from ;; matlab-mode.el. Warning: I am no lisp programmer. ;; The support for ;; syntax-highlighting (ie font-lock-mode) was added by Neel Krishnaswami ;; in July 1999. ;; ;; Octave-mode.el was modified by John W. Eaton (jwe@che.utexas.edu) from ;; the file matlab-mode.el which is: ;; ;; Copyright (C) 1991 Matthew R. Wette. ;; Everyone is granted permission to copy, modify and redistribute this ;; file provided: ;; 1. All copies contain this copyright notice. ;; 2. All modified copies shall carry a prominant notice stating who ;; made the last modification and the date of such modification. ;; 3. No charge is made for this software or works derived from it. ;; This clause shall not be construed as constraining other software ;; distributed on the same medium as this software, nor is a ;; distribution fee considered a charge. ;; ;; ;; Constants used in all Gauss-mode buffers. (defconst gauss-indent-level 2 "*The indentation in Gauss-mode.") (defconst gauss-comment-column 40 "*The goal comment column in Gauss-mode buffers.") ;; Syntax Table (defvar gauss-mode-syntax-table nil "Syntax table used in Gauss-mode buffers.") (if gauss-mode-syntax-table () (setq gauss-mode-syntax-table (make-syntax-table)) (modify-syntax-entry ?\\ "." gauss-mode-syntax-table) (modify-syntax-entry ?/ "." gauss-mode-syntax-table) (modify-syntax-entry ?* "." gauss-mode-syntax-table) (modify-syntax-entry ?+ "." gauss-mode-syntax-table) (modify-syntax-entry ?- "." gauss-mode-syntax-table) (modify-syntax-entry ?= "." gauss-mode-syntax-table) (modify-syntax-entry ?< "." gauss-mode-syntax-table) (modify-syntax-entry ?> "." gauss-mode-syntax-table) (modify-syntax-entry ?& "." gauss-mode-syntax-table) (modify-syntax-entry ?| "." gauss-mode-syntax-table) (modify-syntax-entry ?\' "\"" gauss-mode-syntax-table) (modify-syntax-entry ?@ "\"" gauss-mode-syntax-table) (modify-syntax-entry ?/ ". 14b" gauss-mode-syntax-table) (modify-syntax-entry ?* ". 23b" gauss-mode-syntax-table) (set-syntax-table gauss-mode-syntax-table)) ;; Abbrev Table (defvar gauss-mode-abbrev-table nil "Abbrev table used in Gauss-mode buffers.") (define-abbrev-table 'gauss-mode-abbrev-table ()) ;; Syntax Highlighting (defvar gauss-compiler-directives (mapconcat 'identity '( "#define\\>" "#definecs\\>" "#undef\\>" "#ifdef\\>" "#ifndef\\>" "#iflight\\>" "#ifdos\\>" "#ifos2win\\>" "#ifunix\\>" "#else\\>" "#endif\\>" "#include\\>" "#lineson\\>" "#linesoff\\>" "#srcfile\\>" "#srcline\\>") "\\|")) (defvar gauss-keywords (mapconcat 'identity '("\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\" "\\") "\\|")) (defvar gauss-types (mapconcat 'identity '("\\" "\\" "\\" "\\" "\\" "\\") "\\|")) (defvar gauss-identifier "[a-zA-Z0-9_]+") (defvar gauss-local-declaration (concat "\\ wrote in message news:... > > @ This is one line comment @ > > Is > > @ this is > a two line comment @ > > valid? Or is > > @ this is a one line comment > > valid? How about > > @ comment @ not comment > > ? > > > /* > > This is multiple-lines comments > > */ > > > My current syntax table is as the follows but it did not work. > > You don't give us enough info to know what you did and what failed to happen. > > > (modify-syntax-entry ?@ "\"" gauss-mode-syntax-table) > > This is wrong because it says @ is used for strings rather than > for comments. You probably want to use "!" instead of "\"" although > it depends on the answers to the above questions. > > > (modify-syntax-entry ?/ ". 14b" gauss-mode-syntax-table) > > (modify-syntax-entry ?* ". 23b" gauss-mode-syntax-table) > > That looks right. > > > Stefan