From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#14061: 24.3.50; Globbing in completion not working correctly Date: Wed, 27 Mar 2013 03:49:38 +0100 Message-ID: <87ehf1imkd.fsf@web.de> References: <87ip4dg53q.fsf@web.de> <87ip4disco.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1364352650 15553 80.91.229.3 (27 Mar 2013 02:50:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Mar 2013 02:50:50 +0000 (UTC) To: 14061@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 27 03:51:16 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UKgSI-0000Uu-HE for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Mar 2013 03:51:14 +0100 Original-Received: from localhost ([::1]:52232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKgRu-0007HL-Ie for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Mar 2013 22:50:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKgRo-0007Gx-1M for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2013 22:50:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKgRl-0001tG-AT for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2013 22:50:43 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKgRl-0001t3-7P for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2013 22:50:41 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UKgU2-0006m3-PV for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2013 22:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Mar 2013 02:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14061 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14061-submit@debbugs.gnu.org id=B14061.136435273925978 (code B ref 14061); Wed, 27 Mar 2013 02:53:02 +0000 Original-Received: (at 14061) by debbugs.gnu.org; 27 Mar 2013 02:52:19 +0000 Original-Received: from localhost ([127.0.0.1]:46639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UKgTK-0006kw-UX for submit@debbugs.gnu.org; Tue, 26 Mar 2013 22:52:19 -0400 Original-Received: from mout.web.de ([212.227.15.3]:53286) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UKgTH-0006kn-5r for 14061@debbugs.gnu.org; Tue, 26 Mar 2013 22:52:16 -0400 Original-Received: from drachen.dragon ([89.204.135.66]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0M6mPA-1UZ1vM41zg-00wawh; Wed, 27 Mar 2013 03:49:52 +0100 In-Reply-To: <87ip4disco.fsf@web.de> (Michael Heerdegen's message of "Wed, 27 Mar 2013 01:44:39 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Provags-ID: V02:K0:eEwnkoRll8ylilOi8gRunNf0LxFXkuNmybnElzOKbLi ezzrCM2imuILVBNFBF3l4Xk70fqNbY+EDtnaexdt/DEoT5dRyz DDjKQbdwG59B36jlbgW5whIM8mdJtcBPMuRhUBq1W1TTwkF8kF 8tfmGkMRBkgQhvB63GEVxugl/nAF+FvPS+Pvjo3zbiTUEBaNjw VJRV6/jUq68bcUjqRfaB7lcc1zquUglmloK+rrtups= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72929 Archived-At: Michael Heerdegen writes: > > C-h v *compil*warn* TAB TAB > > > > "byte-compile-warnings" should be among the matches, but that's not > > the case. > > Looks like `completion-pcm--merge-completions' is introducing the error: > > (completion-pcm--merge-completions > '("byte-compile-error-on-warn" > "byte-compile-warning-types" > "byte-compile-warnings" > "byte-compile-last-warned-form") > '(star "compil" star "warn")) > > ==> > > (any "warn" "-" star "compile-" "byte-") Some more thoughts: In the definition of `completion-pcm--merge-completions', we have (when (memq elem '(star point prefix)) ;; Extract common suffix additionally to common prefix. ;; Only do it for `point', `star', and `prefix' since for ;; `any' it could lead to a merged completion that ;; doesn't itself match the candidates. (let ((suffix (completion--common-suffix comps))) (cl-assert (stringp suffix)) (unless (equal suffix "") (push suffix res)))) In the pathological cases, the `suffix' includes a hyphen that is already included in the prefix: (completion-pcm--merge-completions '("byte-compile-error-on-warn" "byte-compile-warning-types" "byte-compile-warnings" "byte-compile-last-warned-form") '(star "compil" star "warn")) ;; suffix == "-" (completion-pcm--merge-completions '("byte-compile-a-warning-types" "byte-compile-a-test-warning-types") '(star "compile" star "types")) ;; suffix == "-warning-" but not all cases where `suffix' starts with "-" are problematic: (completion-pcm--merge-completions '("byte-compile-a-c-b-warning-types" "byte-compile-a-test-b-warning-types") '(star "compile" star "types")) so it would be wrong to remove a leading "-" from `suffix' unconditionally. Dunno what a good fix would look like. It tried (let* ((pre-length (length prefix)) (suffix (completion--common-suffix (mapcar (lambda (comp) (substring comp pre-length)) comps)))) (cl-assert (stringp suffix)) (unless (equal suffix "") (push suffix res))) which seems to work, but my insight in this code is limited. HTH, Michael.