[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
advice needed for font-lock-syntactic-face-function
From: |
Gian Uberto Lauri |
Subject: |
advice needed for font-lock-syntactic-face-function |
Date: |
Fri, 16 Jan 2004 12:52:49 +0100 |
I'm trying to borrow the function from tex-mode.el (CVS version) to
mark. html tags and JSP/ASP/PHP blocks, and I took the piece of code
that matches \verb+ + blocks as example.
(defun html-helper-font-lock-last-char-helper ()
(when (eq (char-syntax (preceding-char)) ?/)
(put-text-property (1- (point)) (point) 'syntax-table '(1)))
(unless (eobp)
(put-text-property (point) (1+ (point)) 'syntax-table '(7))))
(defun html-helper-font-lock-syntactic-face-function (state)
(let ((char (nth 3 state)))
(cond
;; char ,bh(B nil
((not char) font-lock-comment-face)
(t
(cond ((string-match "[a-zA-Z]" (char-to-string char))
;; This is an HTML tag
(save-excursion
(unless (search-forward-regexp "[^%?]>" nil t)
(goto-char (point-max)))
(html-helper-font-lock-last-char-helper))
html-helper-tag-face)
((string-match "[%?]" (char-to-string char))
;; This is a server script block
(save-excursion
(unless (search-forward-regexp "[%?]>" nil t)
(goto-char (point-max)))
(html-helper-font-lock-last-char-helper))
html-helper-server-script-face)
((eq ? char)
;; This is a server script block
(unless (search-forwardd "-->" nil t)
(save-excursion
(goto-char (point-max))))
font-lock-comment-face))))))
Executing my function step by step i verified that I successfully set
up font-lock-syntactic-keywords, I successfully matched a tag but
after leaving the save-excursion block I see that the program enters
this sexp
(set-syntax-table old-syntax-table)
and after some more steps (about 8) I get stuck in the
(mode-line-mode-name)
sexp.
I fear that there's something weird in the put-text-property sexps in
html-helper-font-lock-last-char-helper function.
Is there anybody who can (and wants) to give me some advice ?
The tex-mode original works fine, of course :).
TIA
/\ ___
/___/\__|_|\_|__|___Gian Uberto Lauri_____________________
//--\ | | \| | Integralista GNUslamico e fancazzista
\/
Re: How to delete/unbind a name defined in Emacs Lisp?, Jesper Harder, 2004/01/06