From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Joe Corneli Newsgroups: gmane.emacs.help Subject: Re: How to "import" font-lock keywords? Date: Wed, 01 Dec 2004 03:15:07 -0600 Message-ID: References: <5bf353bb.0412010031.1f4a083b@posting.google.com> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1101892590 29101 80.91.229.6 (1 Dec 2004 09:16:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 1 Dec 2004 09:16:30 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 01 10:16:23 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CZQb0-0002Cj-00 for ; Wed, 01 Dec 2004 10:16:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CZQkU-0005qG-Pz for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Dec 2004 04:26:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CZQjn-0005q2-PK for help-gnu-emacs@gnu.org; Wed, 01 Dec 2004 04:25:27 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CZQjm-0005po-E9 for help-gnu-emacs@gnu.org; Wed, 01 Dec 2004 04:25:26 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CZQjl-0005pk-TE for help-gnu-emacs@gnu.org; Wed, 01 Dec 2004 04:25:26 -0500 Original-Received: from [146.6.139.124] (helo=dell3.ma.utexas.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CZQZo-0002eU-Bt for help-gnu-emacs@gnu.org; Wed, 01 Dec 2004 04:15:08 -0500 Original-Received: from linux183.ma.utexas.edu (mail@linux183.ma.utexas.edu [146.6.139.172]) by dell3.ma.utexas.edu (8.11.0.Beta3/8.10.2) with ESMTP id iB19F7806488; Wed, 1 Dec 2004 03:15:07 -0600 Original-Received: from jcorneli by linux183.ma.utexas.edu with local (Exim 3.36 #1 (Debian)) id 1CZQZn-0000wN-00; Wed, 01 Dec 2004 03:15:07 -0600 Original-To: help-gnu-emacs@gnu.org In-reply-to: <5bf353bb.0412010031.1f4a083b@posting.google.com> (lee.munheng@linuxmail.org) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:22457 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:22457 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.)