aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Aspinall1999-11-16 16:00:39 +0000
committerDavid Aspinall1999-11-16 16:00:39 +0000
commitb60783fa894f0956cb581c8f2aee1423faf12096 (patch)
tree4baf59e4edc9394d40ae5a8565465af696e87a3e
parenteac7e215f82098ab290a30c354969bfe3a4b27ac (diff)
Added proof-string-match-safe and proof-stringfn-match (also safe)
-rw-r--r--generic/proof-syntax.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/generic/proof-syntax.el b/generic/proof-syntax.el
index 6f887f9a..c3a76f70 100644
--- a/generic/proof-syntax.el
+++ b/generic/proof-syntax.el
@@ -56,6 +56,17 @@ nil if a region cannot be found."
((case-fold-search proof-case-fold-search))
(string-match regexp string start)))
+(defun proof-string-match-safe (regexp string &optional start)
+ "Like proof-string-match, but return nil if REGEXP is nil."
+ (if regexp (proof-string-match regexp string start)))
+
+(defun proof-stringfn-match (regexp-or-fn string)
+ "Like proof-string-match if first arg is regexp, otherwise call it."
+ (cond ((stringp regexp-or-fn)
+ (proof-string-match regexp-or-fn string))
+ ((functionp regexp-or-fn)
+ (regexp-or-fn string))))
+
(defun proof-looking-at (regexp)
"Like looking-at, but set case-fold-search to proof-case-fold-search."
(let