From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: emacs question
Date: Fri, 21 May 2010 15:33:19 +0200 [thread overview]
Message-ID: <87632hjs68.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: AANLkTik92IyyXvjkxEpMYiUUuaf9q9qz3GpTjSV6RJG7@mail.gmail.com
"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
next prev parent reply other threads:[~2010-05-21 13:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AANLkTincb2ng8o-4T3_BRiDU6vFjpPVCqbsjUoXLYE6p@mail.gmail.com>
2010-05-20 14:27 ` emacs question Rina & Avner
2010-05-21 1:27 ` Lennart Borgman
2010-05-21 13:33 ` Tassilo Horn [this message]
[not found] ` <mailman.5.1274448820.9020.help-gnu-emacs@gnu.org>
2010-05-24 0:28 ` Stefan Monnier
2013-01-13 17:48 EMACS question Kurt Jordan
2013-01-13 19:10 ` Drew Adams
2013-01-13 19:51 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2008-11-26 13:44 emacs question Craig Petty
2008-11-11 17:02 emacs Question Craig Petty
2008-11-11 18:47 ` Peter Dyballa
[not found] ` <mailman.90.1226429278.26697.help-gnu-emacs@gnu.org>
2008-11-12 3:44 ` TheFlyingDutchman
[not found] <mailman.5982.1103055549.27204.help-gnu-emacs@gnu.org>
2004-12-15 15:20 ` emacs question kgold
2004-12-15 14:41 Villa, Maria (HBO)
2004-12-15 16:00 ` Gian Uberto Lauri
2004-12-14 19:45 Villa, Maria (HBO)
2004-12-14 22:04 ` Rodrigo Canellas
2004-12-14 22:40 ` Harshdeep Jawanda
[not found] ` <mailman.6016.1103064708.27204.help-gnu-emacs@gnu.org>
2004-12-15 1:18 ` Neil Woods
2004-12-15 15:32 ` Harshdeep Jawanda
2004-12-15 16:36 ` Kevin Rodgers
2004-12-15 6:54 ` Gian Uberto Lauri
[not found] <mailman.6625.1099324620.2017.help-gnu-emacs@gnu.org>
2004-11-01 17:29 ` Kevin Rodgers
2004-11-01 15:47 Jeffrey Leitner
2004-11-01 21:36 ` Ehud Karni
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=87632hjs68.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=help-gnu-emacs@gnu.org \
/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.