diff options
author | Jim Blandy <jimb@redhat.com> | 1993-03-15 04:46:45 +0000 |
---|---|---|
committer | Jim Blandy <jimb@redhat.com> | 1993-03-15 04:46:45 +0000 |
commit | c87b5da53e9cd63448d2c9b7f957c8ceb4985196 (patch) | |
tree | dc0f2d2b63ea16530c16aceaddcc924d97ff9b4b /lisp/sort.el | |
parent | 893365c1558796949f0bf95f789a409103416852 (diff) | |
download | emacs-c87b5da53e9cd63448d2c9b7f957c8ceb4985196.tar.gz |
* sort.el (sort-float-fields, sort-numeric-fields): Use
string-to-number, not string-to-float or string-to-int.
* sort.el (sort-float-fields): Make this autoloaded.
* sort.el (sort-numeric-fields): Doc fix.
Diffstat (limited to 'lisp/sort.el')
-rw-r--r-- | lisp/sort.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/sort.el b/lisp/sort.el index 2d56aee1f9a..8c3285e144a 100644 --- a/lisp/sort.el +++ b/lisp/sort.el @@ -239,12 +239,13 @@ Fields are separated by whitespace and numbered from 1 up. Specified field must contain a number in each line of the region. With a negative arg, sorts by the ARGth field counted from the right. Called from a program, there are three arguments: -FIELD, BEG and END. BEG and END specify region to sort." +FIELD, BEG and END. BEG and END specify region to sort. +If you want to sort floating-point numbers, try `sort-float-fields'." (interactive "p\nr") (sort-fields-1 field beg end (function (lambda () (sort-skip-fields (1- field)) - (string-to-int + (string-to-number (buffer-substring (point) (save-excursion @@ -254,6 +255,7 @@ FIELD, BEG and END. BEG and END specify region to sort." (point)))))) nil)) +;;;###autoload (defun sort-float-fields (field beg end) "Sort lines in region numerically by the ARGth field of each line. Fields are separated by whitespace and numbered from 1 up. Specified field |