Article View: gnu.emacs.bug
Article #1868`sort-numeric-fields' has a weak idea of what constitutes a number
From: Eric Hanchrow
Date: Thu, 08 Feb 1990 00:59
Date: Thu, 08 Feb 1990 00:59
24 lines
1559 bytes
1559 bytes
GNU Emacs 18.55.
In `sort.el' (sort-numeric-fields), I see
(function (lambda ()
(sort-skip-fields (1- field))
(string-to-int
(buffer-substring
(point)
(save-excursion
(skip-chars-forward "[0-9]")
(point))))))
It appears that the `skip-chars-forward' implicitly defines the
regular expression which determines what constitues a number. It
would be nice if this were more general: If perhaps there were a
variable `sort-number-regexp' or something. What brought this to my
attention was the fact that sorting fields which contained negative
numbers didn't work. I changed the line to
(skip-chars-forward "-[0-9]")
and it works fine.
-------------------------------------------------------------------------
|Eric Hanchrow yamada-sun!eric@nosun.west.sun.com |
|Phase III Logic, Inc. ...!{tektronix, sun}!nosun!yamada-sun!eric |
|1600 N.W. 167th Place Beaverton, OR 97006 |
|Voice: (503)-645-0313 Fax: (503)-645-0207 as of 13-Dec-89 |
-------------------------------------------------------------------------
Technical Details
Message-ID:
<9002080059.AA01115@yamada-sun.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!uunet!bu.edu!bu-cs!snorkelwacker!tut.cis.ohio-state.edu!nosun.west.sun.com!yamada-sun!ericShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!uunet!bu.edu!bu-cs!snorkelwacker!tut.cis.ohio-state.edu!nosun.west.sun.com!yamada-sun!eric From: yamada-sun!eric@nosun.west.sun.com (Eric Hanchrow) Newsgroups: gnu.emacs.bug Subject: `sort-numeric-fields' has a weak idea of what constitutes a number Message-ID: <9002080059.AA01115@yamada-sun.UUCP> Date: 8 Feb 90 00:59:01 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 24