unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Ryniker <ryniker@alum.mit.edu>
Subject: sort.el, sort-columns
Date: Tue, 21 Feb 2006 10:12:20 -0500	[thread overview]
Message-ID: <E1FBZBc-00065q-Fd@ryniker.ods.org> (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))

                 reply	other threads:[~2006-02-21 15:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1FBZBc-00065q-Fd@ryniker.ods.org \
    --to=ryniker@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).