bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5689: looking-back-p


From: Devon Sean McCullough
Subject: bug#5689: looking-back-p
Date: Sat, 6 Mar 2010 13:29:46 -0500 (EST)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]