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: font-lock function matcher sample Date: Wed, 04 Aug 2004 19:48:10 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 1091649124 4666 80.91.224.253 (4 Aug 2004 19:52:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 Aug 2004 19:52:04 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 04 21:51:39 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BsRnW-0002m0-00 for ; Wed, 04 Aug 2004 21:51:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BsRr1-0007oO-K1 for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Aug 2004 15:55:15 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn14feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!snoopy.risq.qc.ca!charlie.risq.qc.ca!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 55 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 1091648890 132.204.24.84 (Wed, 04 Aug 2004 15:48:10 EDT) Original-NNTP-Posting-Date: Wed, 04 Aug 2004 15:48:10 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:124653 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 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:19986 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19986 >>>> How about the code below instead: >>>> (defun beatnik-=-matcher-p (limit score-match) >>>> "Tries to find a word whose scrable score matches score-match. >>>> If such a word was found, t is returned." >>>> (let (found) >>>> (while (and (setq found (re-search-forward >>>> beatnik-font-matcher-regexp limit t)) >>>> (/= (beatnik-last-word-score) score-match))) >>>> found)) >> >>> This is almost what I intended. This sets `found' to `t' even when the asked >>> for scrabble score via (beatnik-last-word-score) isn't found. >> Huh? The while loop is only exited if found is nil or if >> (beatnik-last-word-score) is equal to score-match, AFAICT. > You're right about the while loop, but still you're setting `found' to > `t' even when the word doesn't equal score-match. And it is `found' that > is returned But if it is t and score-match is not equal, than you go around the loop once more where found will be reset to either nil or t depending on whether there are more words to find. So I still don't understand the problem. > (defun beatnik-=-matcher-p (limit score-match) > "Tries to find a word whose scrable score matches score-match. > If such a word was found, t is returned." > (let (found) > ;; doesn't work: > (while (setq found (and (re-search-forward > beatnik-font-matcher-regexp limit t)) > (/= (beatnik-last-word-score) score-match))) > found)) This will always return nil because if found is non-nil, we don't exit the loop. > I agree that bugs should be reported and fixed. But I do not really have > a reliable testcase to reproduce them. Especially since RMS himself > stated recently that he cannot check errors on MacOS X since he doesn't > have the hardware. I strongly doubt such problems would be specific to Mac OS X (tho they may have more serious implication since C-g tends not to work as well). >> But even if they get fixed, I agree that debugging font-lock-keywords >> settings is painful. Turning off jit-lock-mode can help, tho. > I couldn't even get edebug-defun to get started, so I did it the > old-fashioned way by using (message "string"). If jit-lock-mode is turned off, edebug-defun should work just fine (at least that's been my experience). With jit-lock, I've had it work and not work at different points in time. Stefan