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: Derived Mode 101 HOWTO Date: Tue, 07 Mar 2006 13:01:02 -0500 Organization: Bell Sympatico Message-ID: <87mzg2jgdy.fsf-monnier+gnu.emacs.help@gnu.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1141755710 31063 80.91.229.2 (7 Mar 2006 18:21:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 7 Mar 2006 18:21:50 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 07 19:21:48 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 1FGgo6-0000WJ-Pm for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Mar 2006 19:21:15 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FGgo5-0000nB-Nn for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Mar 2006 13:21:13 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:vQ257S6s3uML7ONpiMTPqy7pBpA= Original-Lines: 63 Original-NNTP-Posting-Host: 70.48.80.201 Original-X-Complaints-To: abuse@sympatico.ca Original-X-Trace: news20.bellglobal.com 1141754462 70.48.80.201 (Tue, 07 Mar 2006 13:01:02 EST) Original-NNTP-Posting-Date: Tue, 07 Mar 2006 13:01:02 EST Original-Xref: shelby.stanford.edu gnu.emacs.help:138007 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:33627 Archived-At: Place at the beginning of your newlisp.el file: (require 'scheme) > (defface font-lock-newlisp-keywords-face > '((((class color) (background dark)) (:foreground "tan")) > (((class color) (background light)) (:foreground "green4")) > (((class grayscale) (background light)) (:foreground "DimGray" :italic t)) > (((class grayscale) (background dark)) (:foreground "LightGray" :italic t)) > (t (:bold t))) > "Font Lock mode face used to highlight > keywords for Newlisp programming language." > :group 'font-lock-faces) > (defvar font-lock-newlisp-keywords-face 'font-lock-newlisp-keywords-face) > (defconst word-begin "\\b\\(") > (defconst word-end "\\)\\b") Every global name you define should use the "newlisp-" prefix. > (defconst > newlisp-keywords ;; just a few > (regexp-opt '( > "acos" "add" "and" "append" "append" "apply" "args" "array" > ) ) ) > (defvar newlisp-font-lock-keywords nil "List of newlisp keywords and faces") Initialize it directly: (defvar newlisp-font-lock-keywords `(,@scheme-font-lock-keywords (,(concat "\\<\\(" newlisp-keywords "\\)\\>") . font-lock-newlisp-keywords-face)) "List of newlisp keywords and faces") > (add-hook 'scheme-mode-hook > (lambda () > (progn > (require 'font-lock) > (setq newlisp-font-lock-keywords > (list > '((concat word-begin newlisp-keywords word-end) > font-lock-newlisp-keywords-face ) > )) > (setq scheme-font-lock-keywords > (append scheme-font-lock-keywords newlisp-font-lock-keywords)) > (message "Newlisp extensions added for Xemacs")))) Replace by define-derived-mode: (define-derived-mode newlisp-mode scheme-mode "Newlisp" "A major mode for Newlisp." (set (make-local-variable 'font-lock-defaults) (cons newlisp-font-lock-keywords ;; Copy the rest of font-lock-defaults from ;; scheme-mode if available. (or (cdr font-lock-defaults) '(nil t (("+-*/.<>=!?$%_&~^:" . "w"))))))) Also check (again?) sample-mode.el. Stefan