unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* High Lighting Lisp Forms
@ 2010-02-02 17:56 Peter Keller
  2010-02-02 22:13 ` Peter Keller
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Keller @ 2010-02-02 17:56 UTC (permalink / raw)
  To: help-gnu-emacs

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








^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: High Lighting Lisp Forms
  2010-02-02 17:56 High Lighting Lisp Forms Peter Keller
@ 2010-02-02 22:13 ` Peter Keller
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Keller @ 2010-02-02 22:13 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

Peter Keller <psilord@merlin.cs.wisc.edu> wrote:
> 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.

oops, I meant + characters are grey and ^ ones are yellow.

Sorry...

-pete


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-02 22:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02 17:56 High Lighting Lisp Forms Peter Keller
2010-02-02 22:13 ` Peter Keller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).