From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2382 invoked from network); 30 Aug 2008 12:02:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 30 Aug 2008 12:02:33 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 11766 invoked from network); 30 Aug 2008 12:02:27 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Aug 2008 12:02:27 -0000 Received: (qmail 3287 invoked by alias); 30 Aug 2008 12:02:21 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25555 Received: (qmail 3269 invoked from network); 30 Aug 2008 12:02:20 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 30 Aug 2008 12:02:20 -0000 Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.24]) by bifrost.dotsrc.org (Postfix) with ESMTP id 16EB4801E2B4 for ; Sat, 30 Aug 2008 14:02:14 +0200 (CEST) Received: by ey-out-2122.google.com with SMTP id 25so427645eya.3 for ; Sat, 30 Aug 2008 05:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=9/3qg+wOWkAkFJSbn5m0xZ1PnQZlFX75hzNj7W4zZQM=; b=ZkRyb/R5VXUOUPe/dXZaFt0qENCXStehJLHTp091Q/1uYBWs/8liwZwx8IVKi8C8vN iv0uU5sSmQ+Ht0yP3VlKB6ino4Necp+qX4PLaCJFhRCzDPs+iF5I7PWR8tulVNMWfY8u ACo/2G4tkQuakKjtLyaLP4KfjJtP0cmMlw5zA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=Ul+I1vPsiT/UfwDemKVxLoc4w7KWJ12YPC5sQQ8V5NMFsA8XwU7DC7lHjOVY+molx8 2seu1roqmhLWkYikDYBK+tK7+wscfnGSxGLf4XOxWGGjXmM7RRIq3trZxjtvU6eVrjux Zc0h8fVmaSjhC6u+0SnNgr7oAjT0QpuS1nzHI= Received: by 10.210.61.8 with SMTP id j8mr3129202eba.123.1220097734711; Sat, 30 Aug 2008 05:02:14 -0700 (PDT) Received: by 10.210.73.14 with HTTP; Sat, 30 Aug 2008 05:02:14 -0700 (PDT) Message-ID: <237967ef0808300502g4381ed95if84ca7dd18b9445d@mail.gmail.com> Date: Sat, 30 Aug 2008 14:02:14 +0200 From: "Mikael Magnusson" To: zsh-workers Subject: Who is sorting my completion results? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: ClamAV 0.92.1/8120/Sat Aug 30 05:43:49 2008 on bifrost X-Virus-Status: Clean I'm trying to add reflog completion for git (nevermind what that is if you don't know :), they look like foo@{1}, foo@{2}, etc. git reflog gives an already sorted list of reflog entries, but when I try my completion in the shell, they are re- sorted as foo@{1}, foo@{10}, foo@{100}, foo@{2}, etc. Who and why is this list resorted by? (+grammar). (( $+functions[__git_heads] )) || __git_heads () { local expl declare -a branch_names_with_desc branch_names ref_with_desc ref if [[ $PREFIX = *@* ]]; then #XXX this gets sorted by sha1 at least from git-checkout which is obviously bad... compset -P '*@' ref_with_desc=(${(f)"$(_call_program reflogentries git reflog show ${IPREFIX%@})"}) __git_command_successful || return ref=(${ref_with_desc//(#b)*. (*\}):*/$match[1]}) unset PREFIX IPREFIX _wanted reflog expl reflog-entry compadd $* -ld ref_with_desc - $ref else branch_names_with_desc=(${${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname) [%(subject)]"' refs/heads refs/remotes 2>/dev/null)"}#refs/(heads|remotes)/}) __git_command_successful || return branch_names=(${branch_names_with_desc// *}) _wanted heads expl branch-name compadd $* -ld branch_names_with_desc - $branch_names HEAD fi } -- Mikael Magnusson PS I lied a bit in the description wrt this code, but it gets true if you remove -ld ref_with_desc, the results are even worse with it since it gets sorted by the sha1 hash of the commit. DS