]> git.eshelyaron.com Git - emacs.git/commitdiff
(completion-pcm--pattern->regex): When completion-ignore-case is
authorChong Yidong <cyd@stupidchicken.com>
Mon, 1 Sep 2008 21:34:23 +0000 (21:34 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Mon, 1 Sep 2008 21:34:23 +0000 (21:34 +0000)
non-nil, generate a regexp that ignores case.

lisp/minibuffer.el

index a59fac6d556ee9fcdf426c84e3bdfbe31ce29197..163bebb5028a52befa9420d687495983e517133c 100644 (file)
@@ -1381,12 +1381,17 @@ or a symbol chosen among `any', `star', `point'."
           (mapconcat
            (lambda (x)
              (case x
-                      ((star any point)
-                       (if (if (consp group) (memq x group) group)
-                                     "\\(.*?\\)" ".*?"))
-               (t (regexp-quote x))))
-           pattern
-                  ""))))
+              ((star any point)
+               (if (if (consp group) (memq x group) group)
+                   "\\(.*?\\)"
+                 ".*?"))
+               (t
+               (if (and completion-ignore-case
+                        (string-match "[[:alpha:]]" x))
+                   (format "[%s%s]" (downcase x) (upcase x))
+                 (regexp-quote x)))))
+          pattern
+          ""))))
     ;; Avoid pathological backtracking.
     (while (string-match "\\.\\*\\?\\(?:\\\\[()]\\)*\\(\\.\\*\\?\\)" re)
       (setq re (replace-match "" t t re 1)))