diff options
| author | Jim Blandy | 1993-03-15 04:46:45 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-03-15 04:46:45 +0000 |
| commit | a4b13e104e6eb549d60ef7d83f62829e7e699b21 (patch) | |
| tree | 72a4f1374313e939f6d5c991d1b7b433cbfaaa55 | |
| parent | 6da3b16b35d815388316e0633465f33c4c168a63 (diff) | |
| download | emacs-a4b13e104e6eb549d60ef7d83f62829e7e699b21.tar.gz emacs-a4b13e104e6eb549d60ef7d83f62829e7e699b21.zip | |
* 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.
| -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. | |||
| 239 | Specified field must contain a number in each line of the region. | 239 | Specified field must contain a number in each line of the region. |
| 240 | With a negative arg, sorts by the ARGth field counted from the right. | 240 | With a negative arg, sorts by the ARGth field counted from the right. |
| 241 | Called from a program, there are three arguments: | 241 | Called from a program, there are three arguments: |
| 242 | FIELD, BEG and END. BEG and END specify region to sort." | 242 | FIELD, BEG and END. BEG and END specify region to sort. |
| 243 | If you want to sort floating-point numbers, try `sort-float-fields'." | ||
| 243 | (interactive "p\nr") | 244 | (interactive "p\nr") |
| 244 | (sort-fields-1 field beg end | 245 | (sort-fields-1 field beg end |
| 245 | (function (lambda () | 246 | (function (lambda () |
| 246 | (sort-skip-fields (1- field)) | 247 | (sort-skip-fields (1- field)) |
| 247 | (string-to-int | 248 | (string-to-number |
| 248 | (buffer-substring | 249 | (buffer-substring |
| 249 | (point) | 250 | (point) |
| 250 | (save-excursion | 251 | (save-excursion |
| @@ -254,6 +255,7 @@ FIELD, BEG and END. BEG and END specify region to sort." | |||
| 254 | (point)))))) | 255 | (point)))))) |
| 255 | nil)) | 256 | nil)) |
| 256 | 257 | ||
| 258 | ;;;###autoload | ||
| 257 | (defun sort-float-fields (field beg end) | 259 | (defun sort-float-fields (field beg end) |
| 258 | "Sort lines in region numerically by the ARGth field of each line. | 260 | "Sort lines in region numerically by the ARGth field of each line. |
| 259 | Fields are separated by whitespace and numbered from 1 up. Specified field | 261 | Fields are separated by whitespace and numbered from 1 up. Specified field |