help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set-match-data needs match-data


From: David Hansen
Subject: Re: set-match-data needs match-data
Date: Tue, 17 Jul 2007 02:32:16 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]