diff options
author | Richard M. Stallman <[email protected]> | 2007-07-10 03:54:30 +0000 |
---|---|---|
committer | Richard M. Stallman <[email protected]> | 2007-07-10 03:54:30 +0000 |
commit | 45595a4fae2dd3c322bd8991dcc2bdc42dcb00bc (patch) | |
tree | 33f92f3dab976419a757f870316b6d38eab3ad05 /lisp/subr.el | |
parent | ef8878109c47998abea49be9965c757af12cdd64 (diff) |
(looking-at-p, string-match-p): New functions.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index f890caf66e..3804624b0b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -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. |