From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#4219: 23.1; case insensitive + partial completions Date: Sun, 13 Sep 2009 23:35:12 -0400 Message-ID: References: Reply-To: Stefan Monnier , 4219@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1252900041 6565 80.91.229.12 (14 Sep 2009 03:47:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Sep 2009 03:47:21 +0000 (UTC) Cc: 4219@emacsbugs.donarmstrong.com To: Eli Barzilay Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 14 05:47:14 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mn2X3-0007LS-IX for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Sep 2009 05:47:13 +0200 Original-Received: from localhost ([127.0.0.1]:58050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mn2X2-0002H7-8k for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Sep 2009 23:47:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mn2Wy-0002Gu-5e for bug-gnu-emacs@gnu.org; Sun, 13 Sep 2009 23:47:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mn2Wt-0002G2-8F for bug-gnu-emacs@gnu.org; Sun, 13 Sep 2009 23:47:07 -0400 Original-Received: from [199.232.76.173] (port=39102 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mn2Ws-0002Fo-Q9 for bug-gnu-emacs@gnu.org; Sun, 13 Sep 2009 23:47:02 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:49222) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mn2Ws-0002Ft-5Y for bug-gnu-emacs@gnu.org; Sun, 13 Sep 2009 23:47:02 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8E3l0ia015221; Sun, 13 Sep 2009 20:47:00 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n8E3e6cj013929; Sun, 13 Sep 2009 20:40:06 -0700 Resent-Date: Sun, 13 Sep 2009 20:40:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Mon, 14 Sep 2009 03:40:06 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4219 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4219-submit@emacsbugs.donarmstrong.com id=B4219.125289932113235 (code B ref 4219); Mon, 14 Sep 2009 03:40:06 +0000 Original-Received: (at 4219) by emacsbugs.donarmstrong.com; 14 Sep 2009 03:35:21 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from ironport2-out.pppoe.ca (ironport2-out.pppoe.ca [206.248.154.181] (may be forged)) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8E3ZIji013182 for <4219@emacsbugs.donarmstrong.com>; Sun, 13 Sep 2009 20:35:20 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlkFAIZWrUpFpZBe/2dsb2JhbACBUtgihBgFgVaGHg X-IronPort-AV: E=Sophos;i="4.44,381,1249272000"; d="scan'208";a="45635310" Original-Received: from 69-165-144-94.dsl.teksavvy.com (HELO pastel.home) ([69.165.144.94]) by ironport2-out.pppoe.ca with ESMTP; 13 Sep 2009 23:33:35 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id DC99F8356; Sun, 13 Sep 2009 23:35:12 -0400 (EDT) In-Reply-To: (Eli Barzilay's message of "Thu, 20 Aug 2009 22:49:33 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Sun, 13 Sep 2009 23:47:07 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:31077 Archived-At: >>>>> "Eli" == Eli Barzilay writes: > Start with a default Emacs, and > (setq read-file-name-completion-ignore-case t) > (setq completion-styles '(partial-completion)) > Now go to a directory that has two files called > INSTALL > install-sh > Hit `C-x C-f ins TAB' -- it will be completed to "insTALL". I think the patch below will help out. You may still get such inconsistent results in different parts of a completion (e.g. completing "fo-ba" against "FOO-BAR" and "foo-bar" may return "FOO-bar"), but at least the above case should be handled better. Stefan --- minibuffer.el.~1.83.~ 2009-09-02 20:35:02.000000000 -0400 +++ minibuffer.el 2009-09-13 23:31:10.000000000 -0400 @@ -1670,28 +1670,32 @@ (unless (string-match re str) (error "Internal error: %s doesn't match %s" str re)) (let ((chopped ()) - (i 1)) - (while (match-beginning i) - (push (match-string i str) chopped) + (last 0) + (i 1) + next) + (while (setq next (match-end i)) + (push (substring str last next) chopped) + (setq last next) (setq i (1+ i))) ;; Add the text corresponding to the implicit trailing `any'. - (push (substring str (match-end 0)) chopped) + (push (substring str last) chopped) (push (nreverse chopped) ccs)))) ;; Then for each of those non-constant elements, extract the ;; commonality between them. - (let ((res ())) - ;; Make the implicit `any' explicit. We could make it explicit + (let ((res ()) + (fixed "")) + ;; Make the implicit trailing `any' explicit. We could make it explicit ;; everywhere, but it would slow down regexp-matching a little bit. (dolist (elem (append pattern '(any))) (if (stringp elem) - (push elem res) + (setq fixed (concat fixed elem)) (let ((comps ())) (dolist (cc (prog1 ccs (setq ccs nil))) (push (car cc) comps) (push (cdr cc) ccs)) - (let* ((prefix (try-completion "" comps)) - (unique (or (and (eq prefix t) (setq prefix "")) + (let* ((prefix (try-completion fixed comps)) + (unique (or (and (eq prefix t) (setq prefix fixed)) (eq t (try-completion prefix comps))))) (unless (equal prefix "") (push prefix res)) ;; If there's only one completion, `elem' is not useful @@ -1700,7 +1704,8 @@ ;; `any' into a `star' because the surrounding context has ;; changed such that string->pattern wouldn't add an `any' ;; here any more. - (unless unique (push elem res)))))) + (unless unique (push elem res)) + (setq fixed ""))))) ;; We return it in reverse order. res)))))