From: Tim Johnson <tim@johnsons-web.com>
Subject: Re: Derived Mode 101 HOWTO
Date: Wed, 08 Mar 2006 02:58:45 -0000 [thread overview]
Message-ID: <slrne0sfdp.2r9.tim@linus.johnson.com> (raw)
In-Reply-To: 87mzg2jgdy.fsf-monnier+gnu.emacs.help@gnu.org
I have written a file called newlisp-mode.el, based on Stefan's
instructions, as best as I can follow.
Results are as follows:
When loading a .lsp file with GNU emacs, newlisp-mode is loaded without
complaint.
eval->major-mode gives me "newlisp-mode".
However syntax highlighting for 'newlisp-font-lock-keywords fails.
eval->font-lock-defaults shows that the dotted list composed from
newlisp-keywords and font-lock-newlisp-keywords-face
is present.
The scheme font-lock-keywords-face and font-lock-function-name-face
are successfully implemented.
As for Xemacs, loading the file and the mode fails with the following
error message: (may be wrapped and obfuscated by mailer)
Wrong type argument: symbolp,
("\\<\\(a\\(?:cos\\|dd\\|nd\\|pp\\(?:end\\(?:\\)?\\|
ly\\)\\|r\\(?:gs\\|ray\\)\\)\\)\\>"
. font-lock-newlisp-keywords-face)
NOTE: This refers to the same dotted list constructed as a component of
newlisp-font-lock-keywords
;; Code follows:
(require 'scheme)
;; ==========================================================================
(defface font-lock-newlisp-keywords-face
'((((class color) (background dark)) (:foreground "yellow"))
(((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)
;; ==========================================================================
(defconst
newlisp-keywords ;; just a few
(regexp-opt '(
"acos" "add" "and" "append" "append" "apply" "args" "array"
)))
;; ==========================================================================
(defvar newlisp-font-lock-keywords
`(,@scheme-font-lock-keywords
(,(concat "\\<\\(" newlisp-keywords "\\)\\>")
. font-lock-newlisp-keywords-face))
"List of newlisp keywords and faces")
;; ==========================================================================
(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")))))))
--
Tim Johnson <tim@johnsons-web.com>
http://www.alaska-internet-solutions.com
next prev parent reply other threads:[~2006-03-08 2:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-06 17:59 Derived Mode 101 HOWTO Tim Johnson
2006-03-07 18:01 ` Stefan Monnier
2006-03-08 2:58 ` Tim Johnson [this message]
2006-03-08 5:46 ` Stefan Monnier
2006-03-08 16:58 ` Tim Johnson
2006-03-11 17:15 ` Stefan Monnier
2006-03-12 0:57 ` Tim Johnson
2006-03-12 13:49 ` Stefan Monnier
2006-03-13 1:48 ` Tim Johnson
2006-03-13 10:10 ` Johan Bockgård
2006-03-13 17:57 ` Tim Johnson
2006-03-13 21:35 ` Johan Bockgård
2006-03-13 23:57 ` Tim Johnson
2006-03-12 5:29 ` Johan Bockgård
2006-03-12 17:50 ` Tim Johnson
2006-03-12 18:14 ` Johan Bockgård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=slrne0sfdp.2r9.tim@linus.johnson.com \
--to=tim@johnsons-web.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.