bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sort.el, sort-columns


From: Richard Ryniker
Subject: sort.el, sort-columns
Date: Tue, 21 Feb 2006 10:12:20 -0500

In order to comply with the POSIX specifications, the "sort" command in
coreutils (version 5.93) has removed support for the "+...-" type of key
definition.  This makes the "sort-columns" function from sort.el fail
when it uses this command.

The following modification to sort.el (version 1.52 from Savannah) uses
the "-k ..." type of definition that is understood by old and new
versions of the "sort" command.


--- sort.el_1.52        2006-02-21 08:24:35.000000000 -0500
+++ sort.el_1.52_RWR    2006-02-21 09:45:08.000000000 -0500
@@ -498,9 +498,13 @@
          ;; Do not use it if there are any non-font-lock properties
          ;; in the region, since the sort utility would lose the
          ;; properties.
+         ;; POSIX does not allow older sort programs' zero-origin,
+         ;;  "+...-" key specification; use one-origin "-k" argument instead.
          (let ((sort-args (list (if reverse "-rt\n" "-t\n")
-                                (concat "+0." (int-to-string col-start))
-                                (concat "-0." (int-to-string col-end)))))
+                                (concat "-k 1."
+                                        (int-to-string (1+ col-start))
+                                        ",1."
+                                        (int-to-string (1+ col-end)) ) )))
            (when sort-fold-case
              (push "-f" sort-args))
            (apply #'call-process-region beg1 end1 "sort" t t nil sort-args))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]