From: Joe Corneli <jcorneli@math.utexas.edu>
Subject: Re: How to "import" font-lock keywords?
Date: Wed, 01 Dec 2004 03:15:07 -0600 [thread overview]
Message-ID: <E1CZQZn-0000wN-00@linux183.ma.utexas.edu> (raw)
In-Reply-To: <5bf353bb.0412010031.1f4a083b@posting.google.com> (lee.munheng@linuxmail.org)
Check out how it is done in tex-mode.el --
you can add font lock keyword collections together as so.
(defconst tex-font-lock-keywords-3
(append tex-font-lock-keywords-2
(eval-when-compile
(let ((general "\\([a-zA-Z@]+\\|[^ \t\n]\\)")
(slash "\\\\")
;; This is not the same regexp as before: it has a `+' removed.
;; The + makes the matching faster in the above cases (where we can
;; exit as soon as the match fails) but would make this matching
;; degenerate to nasty complexity (because we try to match the
;; closing brace, which forces trying all matching combinations).
(arg "{\\(?:[^{}\\]\\|\\\\.\\|{[^}]*}\\)*"))
`((,(concat "[_^] *\\([^\n\\{}]\\|" slash general "\\|" arg "}\\)")
(1 (tex-font-lock-suscript (match-beginning 0))
append))))))
"Experimental expressions to highlight in TeX modes.")
Or, say, like this:
(setq z-latex-font-lock-keywords (append tex-font-lock-keywords-1
z-latex-font-lock-keywords)
"What we highlight.")
(Use the source to find the right variable names.)
next prev parent reply other threads:[~2004-12-01 9:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-01 8:31 How to "import" font-lock keywords? MH Lee
2004-12-01 9:15 ` Joe Corneli [this message]
2004-12-01 14:52 ` Stefan Monnier
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=E1CZQZn-0000wN-00@linux183.ma.utexas.edu \
--to=jcorneli@math.utexas.edu \
/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).