From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Error-Free Navigation in Trees of Sub-Expressions (sexp) in Font-Locking Function Matchers
Date: Wed, 8 Oct 2008 05:31:18 -0700 (PDT) [thread overview]
Message-ID: <d566d4b4-267d-4e7d-9a53-66d6c190db1d@a18g2000pra.googlegroups.com> (raw)
In-Reply-To: bb2699ec-1d05-46eb-939b-d2387a56ac5a@p10g2000prf.googlegroups.com
Ooops...
My initial posting contained two errors.
Here is the correct test code that works in Vanilla Emacs:
(defun pnw-fancy/setq-args-matcher (limit)
(let ((start (point))) ; remember beginning
(if (looking-at (concat "[[:blank:]\n]*" "'?\\(\\w+\\)"))
(progn (goto-char (match-end 1))
(forward-sexp); skip VAL
t)); signal hit
))
(defun pnw-fancy/emacs-lisp-variables-font-locking ()
(font-lock-add-keywords
nil
(list
;; setq-statements: (setq SYM VAL ...)
`(;; MATCHER: (SETQ
,(concat "(" (regexp-opt '("set"
"setq"
"setq-default"
"setq-mode-local") t)
"[[:blank:]\n]*")
;; SUBEXP-HIGHLIGHTER
(1 'font-lock-function-name-face keep)
;; ANCHORED-HIGHLIGHTER: (setq SYM VAL ...)
(;; ANCHORED-MATCHER
pnw-fancy/setq-args-matcher
nil ; PRE-FORM
nil ; POST-FORM
(1 'font-lock-variable-name-face prepend) ; SUBEXP-HIGHLIGHTERS
))
) t))
(add-hook 'emacs-lisp-mode-hook 'pnw-fancy/emacs-lisp-variables-font-
locking)
/Nordlöw
next prev parent reply other threads:[~2008-10-08 12:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-08 12:24 Error-Free Navigation in Trees of Sub-Expressions (sexp) in Font-Locking Function Matchers Nordlöw
2008-10-08 12:31 ` Nordlöw [this message]
2008-10-08 14:15 ` Nikolaj Schumacher
[not found] ` <mailman.565.1223475359.25473.help-gnu-emacs@gnu.org>
2008-10-08 14:30 ` Nordlöw
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d566d4b4-267d-4e7d-9a53-66d6c190db1d@a18g2000pra.googlegroups.com \
--to=per.nordlow@gmail.com \
--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.
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).