all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: Devon Sean McCullough <Emacs-hacker@Jovi.Net>
Cc: 5689@debbugs.gnu.org
Subject: bug#5689: looking-back-p
Date: Sun, 07 Mar 2010 13:17:03 +0100	[thread overview]
Message-ID: <4B93993F.5000208@easy-emacs.de> (raw)
In-Reply-To: <201003061829.o26ITkgP006003@jovi.net>

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







      parent reply	other threads:[~2010-03-07 12:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-06 18:29 bug#5689: looking-back-p Devon Sean McCullough
2010-03-06 21:21 ` Stefan Monnier
2010-03-07 12:17 ` Andreas Röhler [this message]

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=4B93993F.5000208@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=5689@debbugs.gnu.org \
    --cc=Emacs-hacker@Jovi.Net \
    /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.