[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5689: looking-back-p
From: |
Andreas Röhler |
Subject: |
bug#5689: looking-back-p |
Date: |
Sun, 07 Mar 2010 13:17:03 +0100 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081227) |
Devon Sean McCullough wrote:
> Please include the missing looking-back-p
> either as a subst like looking-at-p and string-match-p
>
> --- lisp/subr.el.~1.667.~ 2009-11-24 22:59:23.000000000 -0500
> +++ lisp/subr.el 2010-03-06 12:52:30.000000000 -0500
> @@ -2984,6 +2984,12 @@
> (let ((inhibit-changing-match-data t))
> (looking-at regexp)))
>
> +(defsubst looking-back-p (regexp &optional limit greedy)
> + "\
> +Same as `looking-back' except this saves the match data."
> + (save-match-data
> + (looking-back regexp limit greedy)))
> +
> (defsubst string-match-p (regexp string &optional start)
> "\
> Same as `string-match' except this function does not change the match data."
>
> or as a macro like
>
> --- lisp/subr.el.~1.667.~ 2009-11-24 22:59:23.000000000 -0500
> +++ lisp/subr.el 2010-03-06 13:18:53.000000000 -0500
> @@ -2984,6 +2984,14 @@
> (let ((inhibit-changing-match-data t))
> (looking-at regexp)))
>
> +(defmacro looking-back-p (&rest args)
> + "\
> +Same as `looking-back' except this saves the match data.
> +
> +\(fn REGEXP &optional LIMIT GREEDY)"
> + `(save-match-data
> + (looking-back .,args)))
> +
> (defsubst string-match-p (regexp string &optional start)
> "\
> Same as `string-match' except this function does not change the match data."
>
>
>
>
Hi Devon,
thanks a lot.
As a change usually has pros and cons, just my personal
view:
`save-match-data' changes the way of execution, I'd
like to see it expressingly.
Think code is pretty good readable as it's now.
Andreas