diff options
| author | Richard M. Stallman | 1993-02-07 05:54:14 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-02-07 05:54:14 +0000 |
| commit | 4f1b6c54492ad05632b307285db341955abe973f (patch) | |
| tree | 935abd73b81990a8a171fb2fc7fd297a41cfd0b8 | |
| parent | 70ca75ae695a53325be020e7247b8b58cc48476e (diff) | |
| download | emacs-4f1b6c54492ad05632b307285db341955abe973f.tar.gz emacs-4f1b6c54492ad05632b307285db341955abe973f.zip | |
(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.el | 14 |
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." | |||
| 76 | ;; This handles both ints and floats. | 76 | ;; This handles both ints and floats. |
| 77 | '<) | 77 | '<) |
| 78 | ((consp (car (car sort-lists))) | 78 | ((consp (car (car sort-lists))) |
| 79 | 'buffer-substring-lessp) | 79 | (function |
| 80 | (lambda (a b) | ||
| 81 | (> 0 (compare-buffer-substrings | ||
| 82 | nil (car a) (nth 1 a) | ||
| 83 | nil (car b) (nth 1 b)))))) | ||
| 80 | (t | 84 | (t |
| 81 | 'string<))) | 85 | 'string<))) |
| 82 | (sort sort-lists | 86 | (sort sort-lists |
| @@ -87,7 +91,9 @@ same as ENDRECFUN." | |||
| 87 | ((consp (car (car sort-lists))) | 91 | ((consp (car (car sort-lists))) |
| 88 | (function | 92 | (function |
| 89 | (lambda (a b) | 93 | (lambda (a b) |
| 90 | (buffer-substring-lessp (car a) (car b))))) | 94 | (> 0 (compare-buffer-substrings |
| 95 | nil (car (car a)) (nth 1 (car a)) | ||
| 96 | nil (car (car b)) (nth 1 (car b))))))) | ||
| 91 | (t | 97 | (t |
| 92 | (function | 98 | (function |
| 93 | (lambda (a b) | 99 | (lambda (a b) |
| @@ -123,9 +129,7 @@ same as ENDRECFUN." | |||
| 123 | (let ((start (point))) | 129 | (let ((start (point))) |
| 124 | (funcall (or endkeyfun | 130 | (funcall (or endkeyfun |
| 125 | (prog1 endrecfun (setq done t)))) | 131 | (prog1 endrecfun (setq done t)))) |
| 126 | (if (fboundp 'buffer-substring-lessp) | 132 | (cons start (point)))))) |
| 127 | (cons start (point)) | ||
| 128 | (buffer-substring start (point))))))) | ||
| 129 | ;; Move to end of this record (start of next one, or end of buffer). | 133 | ;; Move to end of this record (start of next one, or end of buffer). |
| 130 | (cond ((prog1 done (setq done nil))) | 134 | (cond ((prog1 done (setq done nil))) |
| 131 | (endrecfun (funcall endrecfun)) | 135 | (endrecfun (funcall endrecfun)) |