]> git.eshelyaron.com Git - emacs.git/commitdiff
(looking-back): Return only t or nil.
authorRichard M. Stallman <rms@gnu.org>
Sat, 16 Oct 2004 15:29:46 +0000 (15:29 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 16 Oct 2004 15:29:46 +0000 (15:29 +0000)
lisp/subr.el

index 60e0694e55aab54ff4366f8e5585c8a62b11dc69..20a2708afadef69640de708d88a096358e3c0b92 100644 (file)
@@ -2023,11 +2023,12 @@ STRING should be given if the last search was by `string-match' on STRING."
 
 (defun looking-back (regexp &optional limit)
   "Return non-nil if text before point matches regular expression REGEXP.
-Like `looking-at' except backwards and slower.
+Like `looking-at' except matches before point, and is slower.
 LIMIT if non-nil speeds up the search by specifying how far back the
 match can start."
-  (save-excursion
-    (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)))
+  (not (null
+       (save-excursion
+         (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)))))
 
 (defconst split-string-default-separators "[ \f\t\n\r\v]+"
   "The default value of separators for `split-string'.