all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Peter Keller <psilord@merlin.cs.wisc.edu>
To: help-gnu-emacs@gnu.org
Subject: High Lighting Lisp Forms
Date: 02 Feb 2010 17:56:12 GMT	[thread overview]
Message-ID: <4b68673c$0$9898$80265adb@spool.cs.wisc.edu> (raw)

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








             reply	other threads:[~2010-02-02 17:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 17:56 Peter Keller [this message]
2010-02-02 22:13 ` High Lighting Lisp Forms Peter Keller

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='4b68673c$0$9898$80265adb@spool.cs.wisc.edu' \
    --to=psilord@merlin.cs.wisc.edu \
    --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.