unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5689: looking-back-p
@ 2010-03-06 18:29 Devon Sean McCullough
  2010-03-06 21:21 ` Stefan Monnier
  2010-03-07 12:17 ` Andreas Röhler
  0 siblings, 2 replies; 3+ messages in thread
From: Devon Sean McCullough @ 2010-03-06 18:29 UTC (permalink / raw)
  To: 5689

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."





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-07 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).