emacs-devel
[Top][All Lists]
Advanced

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

Re: find-file-noselect needs save-match-data


From: Juri Linkov
Subject: Re: find-file-noselect needs save-match-data
Date: Sun, 17 Jun 2007 22:54:14 +0300
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

> and in `Info-fontify-node'
>
>                       (cond ((save-match-data (looking-back "\\<see"))
>                              "")
>                             ((save-match-data (looking-back "\\<in"))
>                              "")
>                             ((memq (char-before) '(nil ?\. ?! ??))
>                                "See ")
>                             ((save-match-data
>                                (save-excursion
>                                  (search-forward "\n\n" start t)))
>                              "See ")
>                             (t "see "))))
>
> both deeply nested in loops.  Did I mention that Info's fontification
> can be a pain?

Funny, but neither of the proposed new functions (`string-match-p' and
`looking-at-p') will help improving the code in info.el above (which uses
`looking-back' and `search-forward').

It seems that instead of adding a prefix/suffix to names of all functions
that change the match-data, it's better to add a new variable and/or a macro
like `save-match-data' with different internals (that will set a global
variable telling match functions not to set the match data).

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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