[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sort-numeric-fields sorts incorrectly
From: |
Glenn Morris |
Subject: |
Re: sort-numeric-fields sorts incorrectly |
Date: |
Mon, 19 Feb 2007 16:50:57 -0500 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Eric Hanchrow wrote:
> 101111
> 0201111
> 0401111
> 301111
> * Type M-x sort-numeric-fields RET. Note that the buffer now contains
> 0201111
> 101111
> 0401111
> 301111
>
> This is a bug, because 0201111 is greater than 101111, and yet
> appears before it.
As the doc-string for sort-numeric-fields explains, values with
leading zeros are interpreted as octal. The output is correct under
this assumption. Get rid of the leading zeros before sorting if this
is not what you want.