From: Juanma Barranquero <lekktu@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Lars Magne Ingebrigtsen <larsi@gnus.org>,
Emacs developers <emacs-devel@gnu.org>
Subject: Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at.
Date: Tue, 13 Aug 2013 04:55:32 +0200 [thread overview]
Message-ID: <CAAeL0SRNdjZ9q13Gc6egDpFg8md7DNdG-ntNJgB8pNyDRh3Rww@mail.gmail.com> (raw)
In-Reply-To: <jwvtxiupdo0.fsf-monnier+emacs@gnu.org>
On Tue, Aug 13, 2013 at 3:46 AM, Stefan Monnier
<monnier@iro.umontreal.ca> 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
next prev parent reply other threads:[~2013-08-13 2:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1V8tmX-0001uj-Of@vcs.savannah.gnu.org>
2013-08-12 15:32 ` trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at Lars Magne Ingebrigtsen
2013-08-12 15:41 ` Juanma Barranquero
2013-08-12 16:18 ` Lars Magne Ingebrigtsen
2013-08-12 16:26 ` Juanma Barranquero
2013-08-12 16:29 ` Glenn Morris
2013-08-12 16:47 ` Lars Magne Ingebrigtsen
2013-08-13 1:46 ` Stefan Monnier
2013-08-13 2:55 ` Juanma Barranquero [this message]
2013-08-13 12:10 ` Lars Magne Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAeL0SRNdjZ9q13Gc6egDpFg8md7DNdG-ntNJgB8pNyDRh3Rww@mail.gmail.com \
--to=lekktu@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.