summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-02-07 05:54:14 +0000
committerRichard M. Stallman <rms@gnu.org>1993-02-07 05:54:14 +0000
commit5492a56e9447b2201261f11987909ce0d7ba665f (patch)
tree63d3781c5d33487a5a8d3d0536eb6beff5b59170
parentab508373fc7457fe7290ed758719c63b8ffd94f6 (diff)
downloademacs-5492a56e9447b2201261f11987909ce0d7ba665f.tar.gz
(sort-build-lists): Record the key as pair of positions;
don't copy string from buffer. (sort-subr): Use compare-buffer-substrings.
-rw-r--r--lisp/sort.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/sort.el b/lisp/sort.el
index 89957618b6b..55376fcddf9 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -76,7 +76,11 @@ same as ENDRECFUN."
;; This handles both ints and floats.
'<)
((consp (car (car sort-lists)))
- 'buffer-substring-lessp)
+ (function
+ (lambda (a b)
+ (> 0 (compare-buffer-substrings
+ nil (car a) (nth 1 a)
+ nil (car b) (nth 1 b))))))
(t
'string<)))
(sort sort-lists
@@ -87,7 +91,9 @@ same as ENDRECFUN."
((consp (car (car sort-lists)))
(function
(lambda (a b)
- (buffer-substring-lessp (car a) (car b)))))
+ (> 0 (compare-buffer-substrings
+ nil (car (car a)) (nth 1 (car a))
+ nil (car (car b)) (nth 1 (car b)))))))
(t
(function
(lambda (a b)
@@ -123,9 +129,7 @@ same as ENDRECFUN."
(let ((start (point)))
(funcall (or endkeyfun
(prog1 endrecfun (setq done t))))
- (if (fboundp 'buffer-substring-lessp)
- (cons start (point))
- (buffer-substring start (point)))))))
+ (cons start (point))))))
;; Move to end of this record (start of next one, or end of buffer).
(cond ((prog1 done (setq done nil)))
(endrecfun (funcall endrecfun))