aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/sort.el14
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)