changeset 106232:f44541b1d13c

(string-prefix-p): New function.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 25 Nov 2009 03:59:19 +0000
parents 7b0de5c2aa2a
children 13733fc37569
files lisp/ChangeLog lisp/subr.el
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Nov 25 03:51:00 2009 +0000
+++ b/lisp/ChangeLog	Wed Nov 25 03:59:19 2009 +0000
@@ -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.
 
--- a/lisp/subr.el	Wed Nov 25 03:51:00 2009 +0000
+++ b/lisp/subr.el	Wed Nov 25 03:59:19 2009 +0000
@@ -3193,6 +3193,13 @@
       (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)