From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: font-lock function matcher sample
Date: Wed, 04 Aug 2004 19:48:10 GMT [thread overview]
Message-ID: <jwvhdriu1y8.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: cerbu8$ld7$1@reader11.wxs.nl
>>>> 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
next prev parent reply other threads:[~2004-08-04 19:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-17 21:08 font-lock function matcher sample Arjan Bos
2004-07-25 8:26 ` Alan Mackenzie
2004-07-25 19:55 ` Arjan Bos
2004-07-26 20:59 ` Stefan Monnier
2004-07-26 21:00 ` Stefan Monnier
2004-07-27 18:12 ` Arjan Bos
2004-07-27 18:36 ` Stefan Monnier
2004-08-03 18:09 ` Arjan Bos
2004-08-03 18:39 ` Stefan Monnier
2004-08-04 18:56 ` Arjan Bos
2004-08-04 19:48 ` Stefan Monnier [this message]
2004-08-04 20:00 ` Arjan Bos
2004-08-04 20:08 ` Stefan Monnier
2004-08-05 19:16 ` Arjan Bos
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvhdriu1y8.fsf-monnier+gnu.emacs.help@gnu.org \
--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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).