all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

* Re: set-match-data needs match-data
       [not found] ` <mailman.3540.1184632703.32220.help-gnu-emacs@gnu.org>
@ 2007-07-17  6:57   ` spamfilteraccount
  0 siblings, 0 replies; 3+ messages in thread
From: spamfilteraccount @ 2007-07-17  6:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Jul 17, 2:32 am, David Hansen <david.han...@gmx.net> wrote:
>
> Returning non nil should be sufficient

I overlooked I should have returned nil. Thanks.

> but this function looks flawed to
> my in another way.  Try
>
> (when (re-search-forward "^(" limit t)
>   ;; ...
>   t)

Yep, that's more correct.  Thanks again.

^ permalink raw reply	[flat|nested] 3+ messages in thread

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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.