[gnu.emacs.bug] Changes to SORT.EL: now works on VMS too

ROBERTS%UORNSRL.BITNET@MITVMA.MIT.EDU (12/01/88)

I've made a few changes in the file sort.el to the procedure sort-columns.
The changes eliminate the call-subprocess-region and use sort-subr instead.
I did this to get it to work on VMS, but since everything is done in emacs
lisp, it should run anywhere.  I'm sending this for consideration as a
change for the next release of GNU Emacs.

Below is the output from the VMS command DIFFERENCES --- not quite the same
as unix, but understandable.  Note that there is a change in the
documentation string, thus the documentation program should be re-run and a
new dump file created for everything to be up to date.

If preferred, I can send the entire procedure sort-columns.

************
File EMACS_LIBRARY:[VMS-STUFF]SORT.EL;1
  321   A prefix argument means sort into reverse order."
  322    (interactive "P\nr")
******
File EMACS_LIBRARY:[VMS-STUFF]SORT.EL-ORIGINAL;1
  321   A prefix argument means sort into reverse order.
  322
  323   Note that sort-columns uses the sort utility program and therefore
  324   cannot work on text containing TAB characters. Use M-x untabify
  325   to convert tabs to spaces before sorting."
  326    (interactive "P\nr")
************
************
File EMACS_LIBRARY:[VMS-STUFF]SORT.EL;1
  335    (save-restriction
  336    (narrow-to-region beg1 end1)
  337    (goto-char beg1)
  338    (sort-subr reverse 'forward-line 'end-of-line
  339    (function (lambda () (move-to-column col-start) nil))
  340    (function (lambda () (move-to-column col-end) nil)))))))
******
File EMACS_LIBRARY:[VMS-STUFF]SORT.EL-ORIGINAL;1
  339    (if (search-backward "\t" beg1 t)
  340    (error "sort-columns does not work with tabs. Use M-x untabify."))
  341    (call-process-region beg1 end1 "sort" t t nil
  342    (if reverse "-rt\n" "-t\n")
  343    (concat "+0." col-start)
  344    (concat "-0." col-end)))))
************

Number of difference sections found: 2
Number of difference records found: 11

DIFFERENCES-
    /IGNORE=(SPACING)/MERGED=1/OUTPUT=EMACS_LIBRARY:[VMS-STUFF]SORT.DIFF;1-
    EMACS_LIBRARY:[VMS-STUFF]SORT.EL;1-
    EMACS_LIBRARY:[VMS-STUFF]SORT.EL-ORIGINAL;1


Roland Roberts                        BITNET: roberts@uornsrl.bitnet
  Nuclear Structure Research Lab    INTERNET: rbr4@db2.cc.rochester.edu
  271 East River Road                   UUCP: rochester!ur-cc!rbr4
  Rochester, NY  14267                  AT&T: (716) 275-8962