* set-match-data needs match-data
@ 2007-07-16 19:38 spamfilteraccount
2007-07-17 0:32 ` David Hansen
[not found] ` <mailman.3540.1184632703.32220.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 3+ messages in thread
From: spamfilteraccount @ 2007-07-16 19:38 UTC (permalink / raw)
To: help-gnu-emacs
In this font lock function the match data is set properly only if
(match-data) is called afterwards. Anyone knows why calling match-data
after set-match-data is necessary here? Emacs 22.
(defun ipa-font-lock-pos-info (limit)
(re-search-forward "^(")
(beginning-of-line)
(let ((sexp-start (point-marker))
sexp-end colon-end)
(forward-sexp)
(setq sexp-end (point-marker))
(forward-char)
(setq colon-end (point-marker))
(set-match-data (list sexp-start ;; whole
colon-end
sexp-start ;; sexp
sexp-end
sexp-end ;; colon
colon-end)))
(match-data))
http://www.emacswiki.org/cgi-bin/emacs/ipa.el
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: set-match-data needs match-data
2007-07-16 19:38 set-match-data needs match-data spamfilteraccount
@ 2007-07-17 0:32 ` David Hansen
[not found] ` <mailman.3540.1184632703.32220.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: David Hansen @ 2007-07-17 0:32 UTC (permalink / raw)
To: help-gnu-emacs
On Mon, 16 Jul 2007 12:38:53 -0700 <spamfilteraccount@gmail.com> wrote:
> In this font lock function the match data is set properly only if
> (match-data) is called afterwards. Anyone knows why calling match-data
> after set-match-data is necessary here? Emacs 22.
>
>
> (defun ipa-font-lock-pos-info (limit)
> (re-search-forward "^(")
> (beginning-of-line)
> (let ((sexp-start (point-marker))
> sexp-end colon-end)
> (forward-sexp)
> (setq sexp-end (point-marker))
> (forward-char)
> (setq colon-end (point-marker))
> (set-match-data (list sexp-start ;; whole
> colon-end
> sexp-start ;; sexp
> sexp-end
> sexp-end ;; colon
> colon-end)))
> (match-data))
Returning non nil should be sufficient but this function looks flawed to
my in another way. Try
(when (re-search-forward "^(" limit t)
;; ...
t)
David
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <mailman.3540.1184632703.32220.help-gnu-emacs@gnu.org>]
end of thread, other threads:[~2007-07-17 6:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-16 19:38 set-match-data needs match-data spamfilteraccount
2007-07-17 0:32 ` David Hansen
[not found] ` <mailman.3540.1184632703.32220.help-gnu-emacs@gnu.org>
2007-07-17 6:57 ` spamfilteraccount
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).