[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
character styles in zmacs
Lemacs, Lucid's variant of GNU Emacs 19, has a very neat
implementation of the feature you describe. It's in the file
lisp/packages/font-lock.el in the lemacs-19.6 distribution (older
versions didn't work as well).
Maybe you can port that back to Zmacs :-)
[head of font-lock.el follows.]
;; Electric Font Lock Mode, by jwz for the LISPM Preservation Society.
;; Copyright (C) 1992-1993 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;; Font-lock-mode is a minor mode that causes your comments to be
;; displayed in one face, strings in another, reserved words in another,
;; documentation strings in another, and so on.
;; Comments will be displayed in `font-lock-comment-face'.
;; Strings will be displayed in `font-lock-string-face'.
;; Doc strings will be displayed in `font-lock-doc-string-face'.
;; Function and variable names (in their defining forms) will be
;; displayed in `font-lock-function-name-face'.
;; Reserved words will be displayed in `font-lock-keyword-face'.
;; To make the text you type be fontified, use M-x font-lock-mode.
;; When this minor mode is on, the fonts of the current line will be
;; updated with every insertion or deletion.
;; The `font-lock-keywords' variable defines other patterns to highlight.
;; The default font-lock-mode-hook sets it to the value of the variables
;; lisp-font-lock-keywords, c-font-lock-keywords, etc, as appropriate.
;; The easiest way to change the highlighting patterns is to change the
;; values of c-font-lock-keywords and related variables.
;; To turn this on automatically, add this to your .emacs file:
;; (setq emacs-lisp-mode-hook '(lambda () (font-lock-mode 1)))
;; On a Sparc2, the initial fontification takes about 12 seconds for a 120k
;; file of C code, using the default configuration. You can speed this up
;; substantially by removing some of the patterns that are highlighted by
;; default. Fontifying lisp code is significantly faster, because lisp has a
;; more regular syntax than C, so the expressions don't have to be as hairy.