diff options
| author | Richard M. Stallman | 2004-03-05 11:31:58 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-03-05 11:31:58 +0000 |
| commit | 2e8d40a1da9d5c70720920103276440f80d9345e (patch) | |
| tree | af3420f4f4d51f34401b31c20832b868fdfc1140 | |
| parent | e4ff63a27cbd8670938bef380226b0f2d08af1e3 (diff) | |
| download | emacs-2e8d40a1da9d5c70720920103276440f80d9345e.tar.gz emacs-2e8d40a1da9d5c70720920103276440f80d9345e.zip | |
(sort-columns): Don't use external 'sort' on ms-windows. Otherwise,
do use it if the region only contains font-lock text properties.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/sort.el | 23 |
2 files changed, 23 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e8353eeea21..57a01d9f081 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2004-03-04 Jesper Harder <harder@ifa.au.dk> | ||
| 2 | |||
| 3 | * sort.el (sort-columns): Don't use external 'sort' on ms-windows. | ||
| 4 | Otherwise, do use it if the region only contains font-lock text | ||
| 5 | properties. | ||
| 6 | |||
| 1 | 2004-03-04 Masatake YAMATO <jet@gyve.org> | 7 | 2004-03-04 Masatake YAMATO <jet@gyve.org> |
| 2 | 8 | ||
| 3 | * hexl.el (hexl-mode): Set `hexl-print-current-point-info' | 9 | * hexl.el (hexl-mode): Set `hexl-print-current-point-info' |
diff --git a/lisp/sort.el b/lisp/sort.el index 541f598e7a5..76559f17288 100644 --- a/lisp/sort.el +++ b/lisp/sort.el | |||
| @@ -480,19 +480,30 @@ Use \\[untabify] to convert tabs to spaces before sorting." | |||
| 480 | (setq col-end (max col-beg1 col-end1)) | 480 | (setq col-end (max col-beg1 col-end1)) |
| 481 | (if (search-backward "\t" beg1 t) | 481 | (if (search-backward "\t" beg1 t) |
| 482 | (error "sort-columns does not work with tabs -- use M-x untabify")) | 482 | (error "sort-columns does not work with tabs -- use M-x untabify")) |
| 483 | (if (not (or (eq system-type 'vax-vms) | 483 | (if (not (or (memq system-type '(vax-vms windows-nt ms-dos)) |
| 484 | (text-properties-at beg1) | 484 | (let ((pos beg1) plist fontified) |
| 485 | (< (next-property-change beg1 nil end1) end1))) | 485 | (catch 'found |
| 486 | (while (< pos end1) | ||
| 487 | (setq plist (text-properties-at pos)) | ||
| 488 | (setq fontified (plist-get plist 'fontified)) | ||
| 489 | (while (consp plist) | ||
| 490 | (unless (or (eq (car plist) 'fontified) | ||
| 491 | (and (eq (car plist) 'face) | ||
| 492 | fontified)) | ||
| 493 | (throw 'found t)) | ||
| 494 | (setq plist (cddr plist))) | ||
| 495 | (setq pos (next-property-change pos nil end1))))))) | ||
| 486 | ;; Use the sort utility if we can; it is 4 times as fast. | 496 | ;; Use the sort utility if we can; it is 4 times as fast. |
| 487 | ;; Do not use it if there are any properties in the region, | 497 | ;; Do not use it if there are any non-font-lock properties |
| 488 | ;; since the sort utility would lose the properties. | 498 | ;; in the region, since the sort utility would lose the |
| 499 | ;; properties. | ||
| 489 | (let ((sort-args (list (if reverse "-rt\n" "-t\n") | 500 | (let ((sort-args (list (if reverse "-rt\n" "-t\n") |
| 490 | (concat "+0." (int-to-string col-start)) | 501 | (concat "+0." (int-to-string col-start)) |
| 491 | (concat "-0." (int-to-string col-end))))) | 502 | (concat "-0." (int-to-string col-end))))) |
| 492 | (when sort-fold-case | 503 | (when sort-fold-case |
| 493 | (push "-f" sort-args)) | 504 | (push "-f" sort-args)) |
| 494 | (apply #'call-process-region beg1 end1 "sort" t t nil sort-args)) | 505 | (apply #'call-process-region beg1 end1 "sort" t t nil sort-args)) |
| 495 | ;; On VMS, use Emacs's own facilities. | 506 | ;; On VMS and ms-windows, use Emacs's own facilities. |
| 496 | (save-excursion | 507 | (save-excursion |
| 497 | (save-restriction | 508 | (save-restriction |
| 498 | (narrow-to-region beg1 end1) | 509 | (narrow-to-region beg1 end1) |