From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: advice needed for font-lock-syntactic-face-function Date: Mon, 19 Jan 2004 22:54:12 GMT Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1074553413 18266 80.91.224.253 (19 Jan 2004 23:03:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 19 Jan 2004 23:03:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 20 00:03:27 2004 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 1AiiQY-0005pJ-00 for ; Tue, 20 Jan 2004 00:03:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AiiPA-0001cC-KL for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Jan 2004 18:02:00 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!charlie.risq.qc.ca!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 54 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-NNTP-Posting-Host: 132.204.24.84 Original-X-Complaints-To: abuse@umontreal.ca Original-X-Trace: charlie.risq.qc.ca 1074552852 132.204.24.84 (Mon, 19 Jan 2004 17:54:12 EST) Original-NNTP-Posting-Date: Mon, 19 Jan 2004 17:54:12 EST Original-Xref: shelby.stanford.edu gnu.emacs.help:120238 Original-To: help-gnu-emacs@gnu.org 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:16180 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16180 > 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