;ELC   
;;; Compiled by pot@pot.cnuce.cnr.it on Tue Mar 18 15:52:04 2003
;;; from file /home/pot/gnu/emacs-pretest.new/lisp/sort.el
;;; in Emacs version 21.3
;;; with bytecomp version 2.85.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`sort.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(custom-declare-group 'sort nil "Commands to sort text in an Emacs buffer." :group 'data)
#@59 *Non-nil if the buffer sort functions should ignore case.
(custom-declare-variable 'sort-fold-case 'nil '(#$ . -700) :group 'sort :type 'boolean)
#@1669 General text sorting routine to divide buffer into records and sort them.
Arguments are REVERSE NEXTRECFUN ENDRECFUN &optional STARTKEYFUN ENDKEYFUN.

We divide the accessible portion of the buffer into disjoint pieces
called sort records.  A portion of each sort record (perhaps all of
it) is designated as the sort key.  The records are rearranged in the
buffer in order by their sort keys.  The records may or may not be
contiguous.

Usually the records are rearranged in order of ascending sort key.
If REVERSE is non-nil, they are rearranged in order of descending sort key.
The variable `sort-fold-case' determines whether alphabetic case affects
the sort order.

The next four arguments are functions to be called to move point
across a sort record.  They will be called many times from within sort-subr.

NEXTRECFUN is called with point at the end of the previous record.
It moves point to the start of the next record.
It should move point to the end of the buffer if there are no more records.
The first record is assumed to start at the position of point when sort-subr
is called.

ENDRECFUN is called with point within the record.
It should move point to the end of the record.

STARTKEYFUN moves from the start of the record to the start of the key.
It may return either a non-nil value to be used as the key, or
else the key is the substring between the values of point after
STARTKEYFUN and ENDKEYFUN are called.  If STARTKEYFUN is nil, the key
starts at the beginning of the record.

ENDKEYFUN moves from the start of the sort key to the end of the sort key.
ENDKEYFUN may be nil if STARTKEYFUN returns a value or if it would be the
same as ENDRECFUN.
(defalias 'sort-subr #[(reverse nextrecfun endrecfun &optional startkeyfun endkeyfun) "deZ\306V\212\203 \307\310!\210\311	\n\f$\312!\203\207 \n\204+ \237\2033 \307\313!\210\314\315!\203V \315\211@@\247\203F \316\202R @@:\203Q \317\202R \320\"\202p \321\211@@\247\203c \322\202o @@:\203n \323\202o \324\"\n\203y \237\203\201 \307\325!\210\326\"\210+\203\220 \307\327!\210*\330\207" [messages nextrecfun endrecfun startkeyfun endkeyfun sort-lists 50000 message "Finding sort keys..." sort-build-lists reverse "Sorting records..." fboundp sortcar < #[(a b) "\302\303\304@A\304	@	A&V\207" [a b 0 compare-buffer-substrings nil] 8] string< sort car-less-than-car #[(a b) "\302\303\304@@@A\304	@@	@A&V\207" [a b 0 compare-buffer-substrings nil] 8] #[(a b) "@	@\231\207" [a b] 2] "Reordering buffer..." sort-reorder-buffer "Reordering buffer... Done" nil old sort-fold-case case-fold-search] 5 (#$ . 854)])
(defalias 'sort-build-lists #[(nextrecfun endrecfun startkeyfun endkeyfun) "\306\211\211\211m\204` `\306\300\307\215	\306\204- \f\203$ \f \210\202- \203-  \210\310\203R :\203J @\n\232\203J A`\232\203J \211B\202O \n`BBB	\204 \203  \210\202 ,\207" [key done start-rec sort-lists endrecfun nextrecfun nil (byte-code "\203	  \206 `\n\206 \305 \210	`)B\207" [startkeyfun start endkeyfun endrecfun done t] 2) t] 4])
(defalias 'sort-reorder-buffer #[(sort-lists old) "\306eeddb\210\307\310!\210	dS}\210\f\203A db\210\311p\n@A@#\210db\210\311p\f@A@\f@AA#\210@AA\fAA\202 db\210\311p\n#\210	|\210db\210	`T}\210``T|,\207" [max min last inhibit-quit sort-lists old t insert-before-markers " " insert-buffer-substring] 4])
#@279 Sort lines in region alphabetically; argument means descending order.
Called from a program, there are three arguments:
REVERSE (non-nil means reverse order), BEG and END (region to sort).
The variable `sort-fold-case' determines whether alphabetic case affects
the sort order.
(defalias 'sort-lines #[(reverse beg end) "\212\214	}\210eb\210\303\n\304\305#*\207" [beg end reverse sort-subr forward-line end-of-line] 4 (#$ . 4220) "P\nr"])
#@284 Sort paragraphs in region alphabetically; argument means descending order.
Called from a program, there are three arguments:
REVERSE (non-nil means reverse order), BEG and END (region to sort).
The variable `sort-fold-case' determines whether alphabetic case affects
the sort order.
(defalias 'sort-paragraphs #[(reverse beg end) "\212\214	}\210eb\210\303\n\304\305#*\207" [beg end reverse sort-subr #[nil "m?\205 \301!\205 \302y\210\202  \207" [paragraph-separate looking-at 1] 2] forward-paragraph] 4 (#$ . 4667) "P\nr"])
#@279 Sort pages in region alphabetically; argument means descending order.
Called from a program, there are three arguments:
REVERSE (non-nil means reverse order), BEG and END (region to sort).
The variable `sort-fold-case' determines whether alphabetic case affects
the sort order.
(defalias 'sort-pages #[(reverse beg end) "\212\214	}\210eb\210\303\n\304\305#*\207" [beg end reverse sort-subr #[nil "\300\301w\207" ["\n" nil] 2] forward-page] 4 (#$ . 5202) "P\nr"])
(byte-code "\301B\304\301!\204\f \305	\204C \306 \307\n\310W\203( \311\n\312#\210\nT\211\202 \311\313\314#\210\311\315\314#\210\311\316\314#\210\311\317\320#\210*\305\207" [current-load-list sort-fields-syntax-table i table boundp nil make-syntax-table 0 256 modify-syntax-entry "w" 32 " " 9 10 46 "_"] 5)
#@50 *The default base used by `sort-numeric-fields'.
(custom-declare-variable 'sort-numeric-base '10 '(#$ . -5992) :group 'sort :type 'integer)
#@505 Sort lines in region numerically by the ARGth field of each line.
Fields are separated by whitespace and numbered from 1 up.
Specified field must contain a number in each line of the region,
which may begin with "0x" or "0" for hexadecimal and octal values.
Otherwise, the number is interpreted according to sort-numeric-base.
With a negative arg, sorts by the ARGth field counted from the right.
Called from a program, there are three arguments:
FIELD, BEG and END.  BEG and END specify region to sort.
(defalias 'sort-numeric-fields #[(field beg end) "\303	\n\304\305%\207" [field beg end sort-fields-1 #[nil "\304!\210\305\306\307!\205' \310\224\203 \310\225b\210\311\202' \312\224\203& \312\225b\210\313\202' \314\315`\212\316\310!\210`){\n\2067 \"*\207" [field case-fold-search base sort-numeric-base sort-skip-fields t looking-at "\\(0x\\)[0-9a-f]\\|\\(0\\)[0-7]" 1 16 2 8 nil string-to-number forward-sexp] 4] nil] 6 (#$ . 6139) "p\nr"])
#@398 Sort lines in region lexicographically by the ARGth field of each line.
Fields are separated by whitespace and numbered from 1 up.
With a negative arg, sorts by the ARGth field counted from the right.
Called from a program, there are three arguments:
FIELD, BEG and END.  BEG and END specify region to sort.
The variable `sort-fold-case' determines whether alphabetic case affects
the sort order.
(defalias 'sort-fields #[(field beg end) "\303	\n\304\305%\207" [field beg end sort-fields-1 #[nil "\301!\210\302\207" [field sort-skip-fields nil] 2] #[nil "\300\301w\207" ["^ 	\n" nil] 2]] 6 (#$ . 7097) "p\nr"])
(defalias 'sort-fields-1 #[(field beg end startkeyfun endkeyfun) "\306 \307	!\203 \310\311\216\212\214\n}\210eb\210\312\f!\210\313\314\315\316%,\207" [tbl field beg end sort-fields-syntax-table startkeyfun syntax-table zerop 1 ((set-syntax-table tbl)) set-syntax-table sort-subr nil forward-line end-of-line endkeyfun] 6])
(defalias 'sort-skip-fields #[(n) "\302V\2038 S\211\302V\203 \303\304w\210\305\304w\210	S\211\202\n \303\304w\210l\2056 \306\307\212\310 \210`)\212\304\210`){\")\207\304\210[S\211\302V\203T \303\304x\210\305\304x\210	S\211\202@ \303\304x\210)n\203n \306\307\212\310 \210`)\212\304\210`){\"\210\305\304x\207" [n i 0 " 	" nil "^ 	\n" error "Line has too few fields: %s" beginning-of-line] 5])
(byte-code "\301B\302B\301\207" [current-load-list sort-regexp-fields-regexp sort-regexp-record-end] 2)
(defalias 'sort-regexp-fields-next-record #[nil "`\303	\304\305#\205. \306\225\211\205. \nU\203' \307u\210\303	\304\305#\210\306\225\211\202( \310\205. \306\224b)\207" [oldpos sort-regexp-fields-regexp sort-regexp-record-end re-search-forward nil move 0 1 t] 4])
#@907 Sort the region lexicographically as specified by RECORD-REGEXP and KEY.
RECORD-REGEXP specifies the textual units which should be sorted.
  For example, to sort lines RECORD-REGEXP would be "^.*$"
KEY specifies the part of each record (ie each match for RECORD-REGEXP)
  is to be used for sorting.
  If it is "\\digit" then the digit'th "\\(...\\)" match field from
  RECORD-REGEXP is used.
  If it is "\\&" then the whole record is used.
  Otherwise, it is a regular-expression for which to search within the record.
If a match for KEY is not found within a record then that record is ignored.

With a negative prefix arg sorts in reverse order.

The variable `sort-fold-case' determines whether alphabetic case affects
the sort order.

For example: to sort lines in the region by the first word on each line
 starting with the letter "f",
 RECORD-REGEXP would be "^.*$" and KEY would be "\\=\<f\\w*\\>"
(defalias 'sort-regexp-fields #[(reverse record-regexp key-regexp beg end) "\306\232\204\f \307\232\203 \310\202 \311\312\"\203 \313H\314Z\212\214	\n}\210eb\210\315\316\f!\210`\310\224b\210\317\320\321\322$,\207" [key-regexp beg end record-regexp sort-regexp-fields-regexp sort-regexp-record-end "" "\\&" 0 string-match "\\`\\\\[1-9]\\'" 1 48 nil re-search-forward sort-subr sort-regexp-fields-next-record #[nil "b\207" [sort-regexp-record-end] 1] #[nil "\303	\247\203\f 	\202 \304	\n\305#\203 \303\202 \306\307\310\"\210\310\311\312\217)\207" [n key-regexp sort-regexp-record-end 0 re-search-forward t throw key nil (byte-code "\224\225B\207" [n] 2) ((error (byte-code "\300\301\302\"\207" [throw key nil] 3)))] 4] reverse] 5 (#$ . 8824) "P\nsRegexp specifying records to sort: \nsRegexp specifying key within record: \nr"])
(byte-code "\301B\302\301!\204\f \303\301\207" [current-load-list sort-columns-subprocess boundp t] 2)
#@719 Sort lines in region alphabetically by a certain range of columns.
For the purpose of this command, the region BEG...END includes
the entire line that point is in and the entire line the mark is in.
The column positions of point and mark bound the range of columns to sort on.
A prefix argument means sort into REVERSE order.
The variable `sort-fold-case' determines whether alphabetic case affects
the sort order.

Note that `sort-columns' rejects text that contains tabs,
because tabs could be split across the specified columns
and it doesn't know how to handle that.  Also, when possible,
it uses the `sort' utility program, which doesn't understand tabs.
Use \[untabify] to convert tabs to spaces before sorting.
(defalias 'sort-columns #[(reverse &optional beg end) "\212\306\211\211\211\211\211^b\210i\307 \210`]b\210i\306y\210`\n^\n]\310\311\312#\203= \313\314!\210 \315=\204\206 \316!\204\206 \317\306\f#\fW\204\206 !\203] \320\202^ \321\322\323	!P\324\323!PE\"#\203v \325\"B\"\326\327\f\330\312\211\306\"&)\202\230 \212\214\f}\210b\210\331!\332\333\334\335%*.\207" [col-end col-start col-end1 col-beg1 end1 beg1 nil beginning-of-line search-backward "	" t error "sort-columns does not work with tabs -- use M-x untabify" vax-vms text-properties-at next-property-change "-rt\n" "-t\n" "+0." int-to-string "-0." "-f" apply call-process-region "sort" sort-subr forward-line end-of-line #[nil "\301!\210\302\207" [col-start move-to-column nil] 2] #[nil "\301!\210\302\207" [col-end move-to-column nil] 2] beg end system-type reverse sort-args sort-fold-case] 9 (#$ . 10693) "P\nr"])
#@106 Reverse the order of lines in a region.
From a program takes two point or marker arguments, BEG and END.
(defalias 'reverse-region #[(beg end) "	V\203 \305	\n)\212b\210n\204 \306y\210`	b\210l\203' n\203- \307y\210\305\210\310 \305\311\203Y b\210`\305\210`{\fB`	U?\203S `T\202T `|\210\2024 \fA\203k \f@\312\261\210\fA\211\202Z \f@c+\207" [beg end mid do ll nil 1 -1 point-marker t "\n"] 3 (#$ . 12330) "r"])
(provide 'sort)
