diff options
| author | Jim Blandy | 1992-08-19 03:54:46 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-08-19 03:54:46 +0000 |
| commit | fbfed6f05fdf5bf363ca5691aefde4d573ce8203 (patch) | |
| tree | 726c22e6a55cb3e760a25f6aa60580d76c8de253 /lisp/sort.el | |
| parent | 4d4c4e027fe376759227a6fb6b31a88be6e36347 (diff) | |
| download | emacs-fbfed6f05fdf5bf363ca5691aefde4d573ce8203.tar.gz emacs-fbfed6f05fdf5bf363ca5691aefde4d573ce8203.zip | |
entered into RCS
Diffstat (limited to 'lisp/sort.el')
| -rw-r--r-- | lisp/sort.el | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/lisp/sort.el b/lisp/sort.el index dd238d326e5..4405b6e77c0 100644 --- a/lisp/sort.el +++ b/lisp/sort.el | |||
| @@ -29,9 +29,10 @@ | |||
| 29 | Arguments are REVERSE NEXTRECFUN ENDRECFUN &optional STARTKEYFUN ENDKEYFUN. | 29 | Arguments are REVERSE NEXTRECFUN ENDRECFUN &optional STARTKEYFUN ENDKEYFUN. |
| 30 | 30 | ||
| 31 | We divide the accessible portion of the buffer into disjoint pieces | 31 | We divide the accessible portion of the buffer into disjoint pieces |
| 32 | called sort records. A portion of each sort record (perhaps all of it) | 32 | called sort records. A portion of each sort record (perhaps all of |
| 33 | is designated as the sort key. The records are rearranged in the buffer | 33 | it) is designated as the sort key. The records are rearranged in the |
| 34 | in order by their sort keys. The records may or may not be contiguous. | 34 | buffer in order by their sort keys. The records may or may not be |
| 35 | contiguous. | ||
| 35 | 36 | ||
| 36 | Usually the records are rearranged in order of ascending sort key. | 37 | Usually the records are rearranged in order of ascending sort key. |
| 37 | If REVERSE is non-nil, they are rearranged in order of descending sort key. | 38 | If REVERSE is non-nil, they are rearranged in order of descending sort key. |
| @@ -78,19 +79,19 @@ same as ENDRECFUN." | |||
| 78 | 'buffer-substring-lessp) | 79 | 'buffer-substring-lessp) |
| 79 | (t | 80 | (t |
| 80 | 'string<))) | 81 | 'string<))) |
| 81 | (sort sort-lists | 82 | (sort sort-lists |
| 82 | (cond ((numberp (car (car sort-lists))) | 83 | (cond ((numberp (car (car sort-lists))) |
| 83 | (function | 84 | (function |
| 84 | (lambda (a b) | 85 | (lambda (a b) |
| 85 | (< (car a) (car b))))) | 86 | (< (car a) (car b))))) |
| 86 | ((consp (car (car sort-lists))) | 87 | ((consp (car (car sort-lists))) |
| 87 | (function | 88 | (function |
| 88 | (lambda (a b) | 89 | (lambda (a b) |
| 89 | (buffer-substring-lessp (car a) (car b))))) | 90 | (buffer-substring-lessp (car a) (car b))))) |
| 90 | (t | 91 | (t |
| 91 | (function | 92 | (function |
| 92 | (lambda (a b) | 93 | (lambda (a b) |
| 93 | (string< (car a) (car b))))))))) | 94 | (string< (car a) (car b))))))))) |
| 94 | (if reverse (setq sort-lists (nreverse sort-lists))) | 95 | (if reverse (setq sort-lists (nreverse sort-lists))) |
| 95 | (if messages (message "Reordering buffer...")) | 96 | (if messages (message "Reordering buffer...")) |
| 96 | (sort-reorder-buffer sort-lists old))) | 97 | (sort-reorder-buffer sort-lists old))) |