[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at.
From: |
Juanma Barranquero |
Subject: |
Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at. |
Date: |
Tue, 13 Aug 2013 04:55:32 +0200 |
On Tue, Aug 13, 2013 at 3:46 AM, Stefan Monnier
<address@hidden> wrote:
> BTW, another thing to learn for this is that we shouldn't bother to
> replace looking-at with looking-at-p.
>
> It can be handy to use looking-at-p if it saves us from using
> save-match-data, but other than that it's not worth the trouble.
I disagree, as I explained before, because I think the greatest
benefit of string-match-p / looking-at-p is that they are predicates.
They're easier to interpret, because you can then forget about ugly
cases like the one which prompted this thread, were the call to the
match-data setting function and its use are quite far apart; that's
error prone, not only to the reader, but to the maintainer that can
easily insert code in between without realizing the mistake.
I don't go out of my way to do the switch, but if I'm fixing other
things or typos or whatever and I find them, and they clearly are used
as predicates, I change them. Every now and them I overlook a use of
match-data, but usually the error is promptly caught.
J
- Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at., Lars Magne Ingebrigtsen, 2013/08/12
- Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at., Juanma Barranquero, 2013/08/12
- Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at., Lars Magne Ingebrigtsen, 2013/08/12
- Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at., Juanma Barranquero, 2013/08/12
- Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at., Glenn Morris, 2013/08/12
- Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at., Lars Magne Ingebrigtsen, 2013/08/12
- Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at., Stefan Monnier, 2013/08/12
- Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at.,
Juanma Barranquero <=
- Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at., Lars Magne Ingebrigtsen, 2013/08/13