aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/sort.el
diff options
context:
space:
mode:
authorJim Blandy1992-08-19 03:54:46 +0000
committerJim Blandy1992-08-19 03:54:46 +0000
commitfbfed6f05fdf5bf363ca5691aefde4d573ce8203 (patch)
tree726c22e6a55cb3e760a25f6aa60580d76c8de253 /lisp/sort.el
parent4d4c4e027fe376759227a6fb6b31a88be6e36347 (diff)
downloademacs-fbfed6f05fdf5bf363ca5691aefde4d573ce8203.tar.gz
emacs-fbfed6f05fdf5bf363ca5691aefde4d573ce8203.zip
entered into RCS
Diffstat (limited to 'lisp/sort.el')
-rw-r--r--lisp/sort.el33
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 @@
29Arguments are REVERSE NEXTRECFUN ENDRECFUN &optional STARTKEYFUN ENDKEYFUN. 29Arguments are REVERSE NEXTRECFUN ENDRECFUN &optional STARTKEYFUN ENDKEYFUN.
30 30
31We divide the accessible portion of the buffer into disjoint pieces 31We divide the accessible portion of the buffer into disjoint pieces
32called sort records. A portion of each sort record (perhaps all of it) 32called sort records. A portion of each sort record (perhaps all of
33is designated as the sort key. The records are rearranged in the buffer 33it) is designated as the sort key. The records are rearranged in the
34in order by their sort keys. The records may or may not be contiguous. 34buffer in order by their sort keys. The records may or may not be
35contiguous.
35 36
36Usually the records are rearranged in order of ascending sort key. 37Usually the records are rearranged in order of ascending sort key.
37If REVERSE is non-nil, they are rearranged in order of descending sort key. 38If 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)))