help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs question


From: Tassilo Horn
Subject: Re: emacs question
Date: Fri, 21 May 2010 15:33:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

"Rina & Avner" <avnerina@gmail.com> writes:

Hi!

> I'm looking for a way to create a new emacs font-lock 'XXX-mode' and
> to add to it a very big set of strings. (VLSI netlist names, sch
> format)
>
> Can you help with some directives?

Well, if you only want to do some highlighting, you probably want to
start with `define-generic-mode'.

,----[ C-h f define-generic-mode RET ]
| define-generic-mode is a Lisp macro in `generic.el'.
| 
| (define-generic-mode MODE COMMENT-LIST KEYWORD-LIST FONT-LOCK-LIST
| AUTO-MODE-LIST FUNCTION-LIST &optional DOCSTRING)
| 
| Create a new generic mode MODE.
| 
| MODE is the name of the command for the generic mode; don't quote it.
| The optional DOCSTRING is the documentation for the mode command.  If
| you do not supply it, `define-generic-mode' uses a default
| documentation string instead.
| 
| COMMENT-LIST is a list in which each element is either a character, a
| string of one or two characters, or a cons cell.  A character or a
| string is set up in the mode's syntax table as a "comment starter".
| If the entry is a cons cell, the `car' is set up as a "comment
| starter" and the `cdr' as a "comment ender".  (Use nil for the
| latter if you want comments to end at the end of the line.)  Note that
| the syntax table has limitations about what comment starters and
| enders are actually possible.
| 
| KEYWORD-LIST is a list of keywords to highlight with
| `font-lock-keyword-face'.  Each keyword should be a string.
| 
| FONT-LOCK-LIST is a list of additional expressions to highlight.  Each
| element of this list should have the same form as an element of
| `font-lock-keywords'.
| 
| AUTO-MODE-LIST is a list of regular expressions to add to
| `auto-mode-alist'.  These regular expressions are added when Emacs
| runs the macro expansion.
| 
| FUNCTION-LIST is a list of functions to call to do some additional
| setup.  The mode command calls these functions just before it runs the
| mode hook `MODE-hook'.
| 
| See the file generic-x.el for some examples of `define-generic-mode'.
`----

For additional infos, have a look at the elisp docs.

,----[ (info "(elisp)Major Modes") ]
| Major modes specialize Emacs for editing particular kinds of text.
| Each buffer has only one major mode at a time.
`----

That for major modes, and that for font locking (highlighting):

,----[ (info "(elisp)Font Lock Mode") ]
| "Font Lock mode" is a feature that automatically attaches `face'
| properties to certain parts of the buffer based on their syntactic
| role.  How it parses the buffer depends on the major mode; most major
| modes define syntactic criteria for which faces to use in which
| contexts.  This section explains how to customize Font Lock for a
| particular major mode.
`----

This should get you started.  Come back when you have a specific
question.

Bye,
Tassilo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]