unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* sort.el, sort-columns
@ 2006-02-21 15:12 Richard Ryniker
  0 siblings, 0 replies; only message in thread
From: Richard Ryniker @ 2006-02-21 15:12 UTC (permalink / raw)


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))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-02-21 15:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-21 15:12 sort.el, sort-columns Richard Ryniker

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).