changeset 97934:ca3f3e68732a

(completion-pcm--pattern->regex): When completion-ignore-case is non-nil, generate a regexp that ignores case.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 01 Sep 2008 21:34:23 +0000
parents f0b85a8f25aa
children 795196147034
files lisp/minibuffer.el
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/minibuffer.el	Mon Sep 01 21:33:51 2008 +0000
+++ b/lisp/minibuffer.el	Mon Sep 01 21:34:23 2008 +0000
@@ -1381,12 +1381,17 @@
           (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)))