diff options
| author | Gerd Moellmann | 2000-11-16 16:43:52 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-11-16 16:43:52 +0000 |
| commit | c844fe9d3f0adda3fc0f618776edde55208e86cf (patch) | |
| tree | b9fd86478d862fd87501c3cfe552db2005a8c807 /lisp | |
| parent | e5effdcc20e1b0d2f58d4f5e63e28197b44ea3eb (diff) | |
| download | emacs-c844fe9d3f0adda3fc0f618776edde55208e86cf.tar.gz emacs-c844fe9d3f0adda3fc0f618776edde55208e86cf.zip | |
(sort-columns): If sort-fold-case it non-nil, invoke
sort(1) with the `-f' argument.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/sort.el | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/sort.el b/lisp/sort.el index dc1cc453e22..0c5d1d9bae0 100644 --- a/lisp/sort.el +++ b/lisp/sort.el | |||
| @@ -493,18 +493,20 @@ Use \\[untabify] to convert tabs to spaces before sorting." | |||
| 493 | ;; Use the sort utility if we can; it is 4 times as fast. | 493 | ;; Use the sort utility if we can; it is 4 times as fast. |
| 494 | ;; Do not use it if there are any properties in the region, | 494 | ;; Do not use it if there are any properties in the region, |
| 495 | ;; since the sort utility would lose the properties. | 495 | ;; since the sort utility would lose the properties. |
| 496 | (call-process-region beg1 end1 "sort" t t nil | 496 | (let ((sort-args (list (if reverse "-rt\n" "-t\n") |
| 497 | (if reverse "-rt\n" "-t\n") | 497 | (concat "+0." col-start) |
| 498 | (concat "+0." col-start) | 498 | (concat "-0." col-end)))) |
| 499 | (concat "-0." col-end)) | 499 | (when sort-fold-case |
| 500 | (push "-f" sort-args)) | ||
| 501 | (apply #'call-process-region beg1 end1 "sort" t t nil sort-args)) | ||
| 500 | ;; On VMS, use Emacs's own facilities. | 502 | ;; On VMS, use Emacs's own facilities. |
| 501 | (save-excursion | 503 | (save-excursion |
| 502 | (save-restriction | 504 | (save-restriction |
| 503 | (narrow-to-region beg1 end1) | 505 | (narrow-to-region beg1 end1) |
| 504 | (goto-char beg1) | 506 | (goto-char beg1) |
| 505 | (sort-subr reverse 'forward-line 'end-of-line | 507 | (sort-subr reverse 'forward-line 'end-of-line |
| 506 | (function (lambda () (move-to-column col-start) nil)) | 508 | #'(lambda () (move-to-column col-start) nil) |
| 507 | (function (lambda () (move-to-column col-end) nil))))))))) | 509 | #'(lambda () (move-to-column col-end) nil)))))))) |
| 508 | 510 | ||
| 509 | ;;;###autoload | 511 | ;;;###autoload |
| 510 | (defun reverse-region (beg end) | 512 | (defun reverse-region (beg end) |