From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: advice needed for font-lock-syntactic-face-function
Date: Mon, 19 Jan 2004 22:54:12 GMT [thread overview]
Message-ID: <jwv8yk3lfsj.fsf-monnier+gnu.emacs.help@asado.iro.umontreal.ca> (raw)
In-Reply-To: mailman.780.1074279472.928.help-gnu-emacs@gnu.org
> 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.
I did not understand what goes wrong with the code you posted: does it get
stuck in an infinite loop? does it fail to highlight? does it
highlight wrong? does it signal an error?
> (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))
I'd recommend (re-search-forward "[^%?]>" nil 'move).
> ((eq ? char)
Since "? " is the first arg to `eq' above, that means there is no
separation betwen the two args, which is poor style. I recommend
(eq char ?\ ) instead which makes the meaningful space much more visible.
> ;; This is a server script block
> (unless (search-forwardd "-->" nil t)
> (save-excursion
> (goto-char (point-max))))
> font-lock-comment-face))))))
This save-excursion block is a nop.
> Executing my function step by step i verified that I successfully set
> up font-lock-syntactic-keywords,
I.e. you checked with C-x = that the proper chars get assigned the proper
syntax-table property?
> I successfully matched a tag but after leaving the save-excursion
> block I see that the program enters this sexp
Which save-excursion block?
> (set-syntax-table old-syntax-table)
I see no such sexp in your code. Which code are you tracing? font-lock's?
If you're tracing font-lock's code, you're better off turning off jit-lock
mode, otherwise it's a complete mess.
> and after some more steps (about 8) I get stuck in the
Are you using edebug? Or which kind of stepping are you doing?
Stefan
next prev parent reply other threads:[~2004-01-19 22:54 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 ` advice needed for font-lock-syntactic-face-function Gian Uberto Lauri
[not found] ` <mailman.780.1074279472.928.help-gnu-emacs@gnu.org>
2004-01-19 22:54 ` Stefan Monnier [this message]
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=jwv8yk3lfsj.fsf-monnier+gnu.emacs.help@asado.iro.umontreal.ca \
--to=monnier@iro.umontreal.ca \
/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.