changeset 1844:d48f094be56e

(sort-build-lists): Record the key as pair of positions; don't copy string from buffer. (sort-subr): Use compare-buffer-substrings.
author Richard M. Stallman <rms@gnu.org>
date Sun, 07 Feb 1993 05:54:14 +0000
parents 2d5caf3fd862
children aeb1a834481b
files lisp/sort.el
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/sort.el	Sun Feb 07 04:56:23 1993 +0000
+++ b/lisp/sort.el	Sun Feb 07 05:54:14 1993 +0000
@@ -76,7 +76,11 @@
 				    ;; 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 @@
 			      ((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 @@
 		      (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))