Auto-commit of generated files.
[bpt/emacs.git] / lisp / gnus / gnus-util.el
index 26178af..4c5eaba 100644 (file)
@@ -1926,6 +1926,18 @@ Same as `string-match' except this function does not change the match data."
     (save-match-data
       (string-match regexp string start))))
 
+(if (fboundp 'string-prefix-p)
+    (defalias 'gnus-string-prefix-p 'string-prefix-p)
+  (defun gnus-string-prefix-p (str1 str2 &optional ignore-case)
+    "Return non-nil if STR1 is a prefix of STR2.
+If IGNORE-CASE is non-nil, the comparison is done without paying attention
+to case differences."
+    (and (<= (length str1) (length str2))
+        (let ((prefix (substring str2 0 (length str1))))
+          (if ignore-case
+              (string-equal (downcase str1) (downcase prefix))
+            (string-equal str1 prefix))))))
+
 (eval-and-compile
   (if (fboundp 'macroexpand-all)
       (defalias 'gnus-macroexpand-all 'macroexpand-all)