diff options
| author | Richard M. Stallman | 1990-12-10 18:52:37 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1990-12-10 18:52:37 +0000 |
| commit | d9a55d3237f7c12b60435ca6a4f0840d84ca0e7c (patch) | |
| tree | 7fa0490a77f86f07cd9227d916af51403c92d215 | |
| parent | 468a4755a7691b0179bcddd9eb9ceed4ae6b914f (diff) | |
| download | emacs-d9a55d3237f7c12b60435ca6a4f0840d84ca0e7c.tar.gz emacs-d9a55d3237f7c12b60435ca6a4f0840d84ca0e7c.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/sort.el | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/lisp/sort.el b/lisp/sort.el index 235f53e57ba..f16c85622ef 100644 --- a/lisp/sort.el +++ b/lisp/sort.el | |||
| @@ -48,7 +48,8 @@ It should move point to the end of the record. | |||
| 48 | STARTKEYFUN may moves from the start of the record to the start of the key. | 48 | STARTKEYFUN may moves from the start of the record to the start of the key. |
| 49 | It may return either return a non-nil value to be used as the key, or | 49 | It may return either return a non-nil value to be used as the key, or |
| 50 | else the key will be the substring between the values of point after | 50 | else the key will be the substring between the values of point after |
| 51 | STARTKEYFUNC and ENDKEYFUN are called. | 51 | STARTKEYFUN and ENDKEYFUN are called. If STARTKEYFUN is nil, the key |
| 52 | starts at the beginning of the record. | ||
| 52 | 53 | ||
| 53 | ENDKEYFUN moves from the start of the sort key to the end of the sort key. | 54 | ENDKEYFUN moves from the start of the sort key to the end of the sort key. |
| 54 | ENDKEYFUN may be nil if STARTKEYFUN returns a value or if it would be the | 55 | ENDKEYFUN may be nil if STARTKEYFUN returns a value or if it would be the |
| @@ -65,20 +66,15 @@ same as ENDRECFUN." | |||
| 65 | (setq sort-lists | 66 | (setq sort-lists |
| 66 | (if (fboundp 'sortcar) | 67 | (if (fboundp 'sortcar) |
| 67 | (sortcar sort-lists | 68 | (sortcar sort-lists |
| 68 | (cond ((floatp (car (car sort-lists))) | 69 | (cond ((numberp (car (car sort-lists))) |
| 69 | 'f<) | 70 | ;; This handles both ints and floats. |
| 70 | ((numberp (car (car sort-lists))) | ||
| 71 | '<) | 71 | '<) |
| 72 | ((consp (car (car sort-lists))) | 72 | ((consp (car (car sort-lists))) |
| 73 | 'buffer-substring-lessp) | 73 | 'buffer-substring-lessp) |
| 74 | (t | 74 | (t |
| 75 | 'string<))) | 75 | 'string<))) |
| 76 | (sort sort-lists | 76 | (sort sort-lists |
| 77 | (cond ((floatp (car (car sort-lists))) | 77 | (cond ((numberp (car (car sort-lists))) |
| 78 | (function | ||
| 79 | (lambda (a b) | ||
| 80 | (f< (car a) (car b))))) | ||
| 81 | ((numberp (car (car sort-lists))) | ||
| 82 | (function | 78 | (function |
| 83 | (lambda (a b) | 79 | (lambda (a b) |
| 84 | (< (car a) (car b))))) | 80 | (< (car a) (car b))))) |
| @@ -135,8 +131,8 @@ same as ENDRECFUN." | |||
| 135 | (equal (car key) start-rec) | 131 | (equal (car key) start-rec) |
| 136 | (equal (cdr key) (point))) | 132 | (equal (cdr key) (point))) |
| 137 | (cons key key) | 133 | (cons key key) |
| 138 | (list key start-rec (point))) | 134 | (cons key (cons start-rec (point)))) |
| 139 | sort-lists))) | 135 | sort-lists))) |
| 140 | (and (not done) nextrecfun (funcall nextrecfun))) | 136 | (and (not done) nextrecfun (funcall nextrecfun))) |
| 141 | sort-lists)) | 137 | sort-lists)) |
| 142 | 138 | ||
| @@ -158,8 +154,8 @@ same as ENDRECFUN." | |||
| 158 | (goto-char (point-max)) | 154 | (goto-char (point-max)) |
| 159 | (insert-buffer-substring (current-buffer) | 155 | (insert-buffer-substring (current-buffer) |
| 160 | (nth 1 (car sort-lists)) | 156 | (nth 1 (car sort-lists)) |
| 161 | (nth 2 (car sort-lists))) | 157 | (cdr (cdr (car sort-lists)))) |
| 162 | (setq last (nth 2 (car old)) | 158 | (setq last (cdr (cdr (car old))) |
| 163 | sort-lists (cdr sort-lists) | 159 | sort-lists (cdr sort-lists) |
| 164 | old (cdr old))) | 160 | old (cdr old))) |
| 165 | (goto-char (point-max)) | 161 | (goto-char (point-max)) |