]> code.delx.au - gnu-emacs/commitdiff
(looking-at-p, string-match-p): New functions.
authorRichard M. Stallman <rms@gnu.org>
Tue, 10 Jul 2007 03:54:30 +0000 (03:54 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 10 Jul 2007 03:54:30 +0000 (03:54 +0000)
etc/NEWS
lisp/ChangeLog
lisp/subr.el

index 290fe0f6c7b63363dbcf55a0b3d9b07115f1ccd8..4323f6ff1cfe9fba0c0685bf602b907b8f553bce 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -131,6 +131,9 @@ but obeys file handlers.  The file handler is chosen based on
 With this paramter passed non-nil, it is checked whether a remote
 connection has been established already.
 
+** The two new functions `looking-at-p' and `string-match-p' can do
+the same matching as `looking-at' and `string-match' without changing
+the match data.
 \f
 * New Packages for Lisp Programming in Emacs 23.1
 
index 58cfca107cb7eea9732d205f16168b313274e3e6..4a95fd8d96d3d7e0ff9e29a0b8cf8a8be8a538d1 100644 (file)
@@ -1,13 +1,6 @@
-2007-07-08  Katsumi Yamaoka  <yamaoka@jpl.org>
-
-       * cus-start.el (file-coding-system-alist): Fix custom type.
-
-2007-07-08  Chong Yidong  <cyd@stupidchicken.com>
+2007-07-10  Guanpeng Xu  <herberteuler@hotmail.com>
 
-       * longlines.el (longlines-wrap-region): Avoid marking buffer as
-       modified.
-       (longlines-auto-wrap, longlines-window-change-function): Remove
-       unnecessary calls to set-buffer-modified-p.
+       * subr.el (looking-at-p, string-match-p): New functions.
 
 2007-07-09  Reiner Steib  <Reiner.Steib@gmx.de>
 
 
        * cus-start.el (file-coding-system-alist): Fix custom type.
 
+2007-07-08  Chong Yidong  <cyd@stupidchicken.com>
+
+       * longlines.el (longlines-wrap-region): Avoid marking buffer as
+       modified.
+       (longlines-auto-wrap, longlines-window-change-function): Remove
+       unnecessary calls to set-buffer-modified-p.
+
+2007-07-08  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * cus-start.el (file-coding-system-alist): Fix custom type.
+
 2007-07-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * vc-cvs.el (vc-cvs-revert): Use vc-default-revert.
index f890caf66e47606bfc02fc7e8713e91a38f4f846..3804624b0b94c9f575576d81e0da9e8f5c7a1743 100644 (file)
@@ -2668,6 +2668,18 @@ of a match for REGEXP."
            (looking-at (concat "\\(?:"  regexp "\\)\\'")))))
     (not (null pos))))
 
+(defsubst looking-at-p (regexp)
+  "\
+Same as `looking-at' except this function does not change the match data."
+  (let ((inhibit-changing-match-data t))
+    (looking-at regexp)))
+
+(defsubst string-match-p (regexp string &optional start)
+  "\
+Same as `string-match' except this function does not change the match data."
+  (let ((inhibit-changing-match-data t))
+    (string-match regexp string start)))
+
 (defun subregexp-context-p (regexp pos &optional start)
   "Return non-nil if POS is in a normal subregexp context in REGEXP.
 A subregexp context is one where a sub-regexp can appear.