From: GianUberto.Lauri@eng.it (Gian Uberto Lauri)
Subject: advice needed for font-lock-syntactic-face-function
Date: Fri, 16 Jan 2004 12:52:49 +0100 [thread overview]
Message-ID: <16391.53393.343787.521286@mail.eng.it> (raw)
In-Reply-To: <jwvd69why1t.fsf-monnier+gnu.emacs.help@asado.iro.umontreal.ca>
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
\/
next prev parent reply other threads:[~2004-01-16 11:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-06 11:41 How to delete/unbind a name defined in Emacs Lisp? WANG Wei
2004-01-06 12:08 ` David Kastrup
2004-01-06 13:57 ` WANG Wei
2004-01-06 14:46 ` Martin Rydstr|m
2004-01-07 1:41 ` WANG Wei
2004-01-07 10:09 ` Stefan Monnier
2004-01-16 11:52 ` Gian Uberto Lauri [this message]
[not found] ` <mailman.780.1074279472.928.help-gnu-emacs@gnu.org>
2004-01-19 22:54 ` advice needed for font-lock-syntactic-face-function Stefan Monnier
2004-01-07 3:28 ` How to delete/unbind a name defined in Emacs Lisp? WANG Wei
2004-01-06 14:34 ` Jesper Harder
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=16391.53393.343787.521286@mail.eng.it \
--to=gianuberto.lauri@eng.it \
--cc=saint@eng.it \
/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.