[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
High Lighting Lisp Forms
From: |
Peter Keller |
Subject: |
High Lighting Lisp Forms |
Date: |
02 Feb 2010 17:56:12 GMT |
User-agent: |
tin/1.8.3-20070201 ("Scotasay") (UNIX) (Linux/2.6.18-164.6.1.el5 (i686)) |
Hello,
Suppose I have some Common Lisp code like this:
(setf *foo* `((1 2 3) ,thingy (4 5 6)))
+ ^^+ + + +^+
I've marked how I would like some characters highlighted. Suppose
those characters with the + are a dark grey, and those with the + are
a yellow.
I'm using slime, and have hacked the crap out of my .emacs file by adding
into the lisp-mode-hook in order to hilight all ANSI Common Lisp constructs
in a manner that pleases me, it sort of looks like this. The #' are
functions resultant from deffaces or something which produces the correct
(REGEXP N FACE) form needed by font-lock-add-keywords.
(add-hook 'lisp-mode-hook
(lambda ()
(font-lock-add-keywords
nil
(append
;; Conventional Constant Variables
'(("\\<\\([+][^ +]*[+]\\)\\>" 0 #'ansi-lisp-constant))
;; Conventional Global Variables, including ANSI ones
'(("\\<\\([*][^ *]*[*]\\)\\>" 0 #'ansi-lisp-global-variable))
;; Lisp Numbers, simple ones, just integers
'(("\\<\\([+-]?[0-9]+\\)\\>" 0 #'ansi-lisp-numbers))
;; General Parenthesis color
'(("\\([()]\\)" 0 #'ansi-lisp-parenthesis))
;; ANSI boolean symbols
(mapcar #'ansi-boolean
'(nil t))
;; many more entries for all of ANSI Common Lisp's symbols in here
))))
So, given this method, if I want the '( ... ) quote and parenthesis to
be higlighted _regardless of where the point is_ then how do I do it?
I know how to do it when I'm moving the point around the buffer, but I want
it all the time and additionally similar behavior for #( #' etc, etc, etc.
Thank you.
-pete
- High Lighting Lisp Forms,
Peter Keller <=