From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Joerg Schuster Newsgroups: gmane.emacs.help Subject: write your own emacs mode Date: 15 Dec 2003 11:06:14 +0100 Organization: Department of Computer Sciences, University of Munich Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1071483327 2898 80.91.224.253 (15 Dec 2003 10:15:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 15 Dec 2003 10:15:27 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 15 11:15:18 2003 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 1AVpkz-0004g5-00 for ; Mon, 15 Dec 2003 11:15:17 +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 1AVqhi-0006Ah-CD for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Dec 2003 06:15:58 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!irazu.switch.ch!switch.ch!news.belwue.de!informatik.tu-muenchen.de!lmu.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 51 Original-NNTP-Posting-Host: pinatubo.cis.uni-muenchen.de Original-X-Trace: minotaurus.cip.informatik.uni-muenchen.de 1071482774 19674 129.187.148.50 (15 Dec 2003 10:06:14 GMT) Original-X-Complaints-To: usenet@informatik.uni-muenchen.de Original-NNTP-Posting-Date: Mon, 15 Dec 2003 10:06:14 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:119328 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:15267 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15267 Hello, I "wrote" (i.e. copied and manipulated) an emacs mode with the help of the following site: http://www.emacswiki.org/cgi-bin/wiki.pl/GenericMode My mode is called grammar-mode, because I use it for editing linguistic grammars of a certain type. grammar-mode works fine except for one thing: It uses to mark strings of a certain form as expressions of type X, although I did not define type X anywhere in the code of grammar-mode. (Example: Strings that are enclosed in quotes are displayed with font-lock-string-face. Yet, in the type of files which I use grammar-mode for, strings of the form '^".*"$' are not wellformed expressions of any type.) How can I prevent this? Another question: Is there a (not too complicated) way to replace the face names like "font-lock-type-face" and so on by more direct descriptions of the face (e.g. "blue")? Jörg ;;;;; Here is the code ;;;;;;;;;;;; ;; grammar-mode (define-generic-mode 'grammar-mode '("%") '("adj" "adj4" "adj5" "adjB" "adjb" "adjc" "adjs" "adv" "advb" "advc" "advs" "advv" "advw" "be" "cnj" "cnjK" "cnjS" "det" "deto" "detw" "en" "eng" "have" "infp" "intj" "n" "n4" "ne" "nem" "ng" "nm" "prep" "pron" "pronj" "pronl" "prono" "pronq" "pronw" "tok" "v" "vC" "vD" "vG" "vG3e" "vI" "vP" "vV") nil '(".syn$") nil "Major mode for editing grammar files as used by pm and skonk.") (defvar grammar-mode-keywords '(("[A-Z][^ ]*" . font-lock-type-face) ; syntactic category ("=[a-zA-Z0-9]+" . font-lock-string-face) ; surface form ("_[a-zA-Z0-9]+" . font-lock-string-face) ; base form ("\\^[a-zA-Z0-9]+" . font-lock-string-face) ; semantic category ("[\*\+\?]" . font-lock-function-name-face) ; *,+,? (":" . font-lock-warning-face))) ; head symbol (font-lock-add-keywords 'grammar-mode syntax-mode-keywords)