]> git.eshelyaron.com Git - emacs.git/commitdiff
(string-prefix-p): New function.
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 25 Nov 2009 03:59:19 +0000 (03:59 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 25 Nov 2009 03:59:19 +0000 (03:59 +0000)
lisp/ChangeLog
lisp/subr.el

index e0125c85b73293b12c5e064d808d4e981ac37634..d02dbadd9cac63578b4e4d9e59e35c6af2b90c14 100644 (file)
@@ -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.
 
index 2bc4c6b2bd2eb2fa330e7505bc31a93f4a611e2a..9cbf4ab9ffcab9304d6526f966589d7d6d4656a6 100644 (file)
@@ -3193,6 +3193,13 @@ and replace a sub-expression, e.g.
       (setq matches (cons (substring string start l) matches)) ; leftover
       (apply #'concat (nreverse matches)))))
 \f
+(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)))
+\f
 ;;;; invisibility specs
 
 (defun add-to-invisibility-spec (element)