summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/subr.el7
2 files changed, 9 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e0125c85b73..d02dbadd9ca 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
2009-11-25 Stefan Monnier <monnier@iro.umontreal.ca>
+ * subr.el (string-prefix-p): New function.
+
* man.el (Man-completion-cache): New var.
(Man-completion-table): Use it.
diff --git a/lisp/subr.el b/lisp/subr.el
index 2bc4c6b2bd2..9cbf4ab9ffc 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3193,6 +3193,13 @@ and replace a sub-expression, e.g.
(setq matches (cons (substring string start l) matches)) ; leftover
(apply #'concat (nreverse matches)))))
+(defun 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."
+ (eq t (compare-strings str1 nil nil
+ str2 0 (length str1) ignore-case)))
+
;;;; invisibility specs
(defun add-to-invisibility-spec (element)