From: Sam Vilain <sam@vilain.net>
Subject: eLisp fontlock with mmm-mode
Date: Wed, 3 Sep 2003 01:41:18 +0100 [thread overview]
Message-ID: <200309030141.18626.sam@vilain.net> (raw)
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."
next reply other threads:[~2003-09-03 0:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-03 0:41 Sam Vilain [this message]
[not found] <mailman.34.1062553939.18171.help-gnu-emacs@gnu.org>
2003-09-03 14:59 ` eLisp fontlock with mmm-mode Joe Kelsey
2003-09-03 17:02 ` Kevin Rodgers
2003-09-05 15:02 ` Joe Kelsey
2003-09-11 22:28 ` Alan Mackenzie
2003-09-12 15:46 ` Joe Kelsey
2003-09-12 21:55 ` Alan Mackenzie
2003-09-12 22:39 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2003-08-12 11:18 Sam Vilain
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=200309030141.18626.sam@vilain.net \
--to=sam@vilain.net \
/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.