From b60783fa894f0956cb581c8f2aee1423faf12096 Mon Sep 17 00:00:00 2001 From: David Aspinall Date: Tue, 16 Nov 1999 16:00:39 +0000 Subject: Added proof-string-match-safe and proof-stringfn-match (also safe) --- generic/proof-syntax.el | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- cgit v1.2.3