From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Sam Vilain Newsgroups: gmane.emacs.help Subject: eLisp fontlock with mmm-mode Date: Wed, 3 Sep 2003 01:41:18 +0100 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <200309030141.18626.sam@vilain.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1062628466 4268 80.91.224.253 (3 Sep 2003 22:34:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 Sep 2003 22:34:26 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 04 00:34:25 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19ugCn-0005RG-00 for ; Thu, 04 Sep 2003 00:34:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19ugBs-0003Eb-0E for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Sep 2003 18:33:28 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 19uMMx-0006Gz-93 for help-gnu-emacs@gnu.org; Tue, 02 Sep 2003 21:23:35 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 19uLrM-0006gS-UD for help-gnu-emacs@gnu.org; Tue, 02 Sep 2003 20:50:58 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.22) id 19uLn7-0005aI-3F for help-gnu-emacs@gnu.org; Tue, 02 Sep 2003 20:46:33 -0400 Original-Received: from [81.99.181.241] (helo=ganymede.dev.surreytech.co.uk) by mx20.gnu.org with esmtp (Exim 4.22) id 19uLi5-00030X-Fc for help-gnu-emacs@gnu.org; Tue, 02 Sep 2003 20:41:21 -0400 Original-Received: from sv by ganymede.dev.surreytech.co.uk with local (Exim 3.35 #1 (Debian)) id 19uLi3-0001Gb-00 for ; Wed, 03 Sep 2003 01:41:19 +0100 Original-To: help-gnu-emacs@gnu.org User-Agent: KMail/1.5.2 Content-Disposition: inline X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:12254 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12254 Hi all, When I try to mix two modes using mmm-ify-by-regexp, there are problems when the context of one interferes with the other. see http://www.vilain.net/emacs/ 00-control.png is a screenshot of the buffer in fundamental mode 01-html-mode.png is the buffer in HTML mode 02-tt-mode.png is the buffer in TT mode, below 03-html[tt]-mmm.png is the buffer mmm-ify'd using the elisp expression on the fourth line. tt-mode.el is the source code for the TT mode (included below) Before taking each screenshot, I used font-lock-fontify-buffer to re-do the highlighting. I would like the mode within the mmm-mode to ignore the current highlighting context of the base mode. Is this possible? If it is more likely a bug in the tt-mode, is there a simple problem with the following syntax highlighting definition that would cause this to happen? I'll include it, because it's quite short: (require 'font-lock) (defvar tt-mode-hook nil "List of functions to call when entering TT mode") (defvar tt-keywords "\\bGET\\b\\|\\bCALL\\b\\|\\bSET\\b\\|\\bDEFAULT \\b\\|\\bINSERT\\b\\|\\bINCLUDE\\b\\|\\bBLOCK\\b\\|\\bEND\\b\\| \\bPROCESS\\b\\|\\bWRAPPER\\b\\|\\bIF\\b\\|\\bUNLESS\\b\\|\\bELSIF \\b\\|\\bELSE\\b\\|\\bSWITCH\\b\\|\\bCASE\\b\\|\\bFOREACH\\b\\| \\bWHILE\\b\\|\\bFILTER\\b\\|\\bUSE\\b\\|\\bMACRO\\b\\|\\bPERL \\b\\|\\bRAWPERL\\b\\|\\bTRY\\b\\|\\bTHROW\\b\\|\\bCATCH\\b\\| \\bFINAL\\b\\|\\bLAST\\b\\|\\bRETURN\\b\\|\\bSTOP\\b\\|\\bCLEAR \\b\\|\\bMETA\\b\\|\\bTAGS") (defvar tt-font-lock-keywords (list ;; Fontify [& ... &] expressions '("\\(\\[%[-+]?\\)\\(.+?\\)\\([-+]?%\\]\\)" (1 font-lock-string-face t) (2 font-lock-variable-name-face t) (3 font-lock-string-face t)) ;; Look for keywords within those expressions (list (concat "\\[%[-+]? *\\(" tt-keywords "\\)") 1 font-lock-keyword-face t) ) "Expressions to font-lock in tt-mode.") (defun tt-mode () "Major mode for editing Template Toolkit files" (interactive) (kill-all-local-variables) (setq major-mode 'tt-mode) (setq mode-name "TT") (if (string-match "Xemacs" emacs-version) (progn (make-local-variable 'font-lock-keywords) (setq font-lock-keywords tt-font-lock-keywords)) ;; Emacs (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(tt-font-lock-keywords nil t)) ) (font-lock-mode) (run-hooks tt-mode-hook)) (provide 'tt-mode) Much appreciated, -- Sam Vilain, sam@vilain.net "This is an object-oriented system. If we change anything, the users object."