sort-lines - Alphabetically sort lines
n sort-lines
sort-lines alphabetically sorts lines of text in the current buffer from the mark position to the current cursor position. If the buffer mode exact(2m) is enabled then the sort is case sensitive, otherwise the sort is case insensitive. By default the text is compared from left to right from column 0 (the left hand edge), if a positive argument n is given then the text is compared left to right from the nth column, any lines shorter than n characters are moved to the top and sorted from column 0.
If a negative argument n is given then the text is sorted in reverse order. The comparison starts at column -1-n, i.e. an argument of -1 sorts in reverse order from column 0.
The following table gives the results of sort-lines for different exact modes and values of n.
___________________________________________________________ Original Sorted Lines ___________________________________________________________ exact - n n y y n n n - - 1 - 1 -1 -2 ___________________________________________________________ B a2 B Aa B CA Aa CA Aa c B c c CA b1 B b1 CA b1 b1 a2 Aa b1 a2 a2 a2 B b1 c c CA b1 CA Aa c a2 CA Aa c Aa a2 B ___________________________________________________________
Typically MicroEmacs is executed with exact(2m) mode enabled, the macro command sort-lines-ignore-case provides a command to sort lines case insensitively while exact mode is enabled. The macro is defined as follows:-
define-macro sort-lines-ignore-case set-variable #l0 &bmod exact -1 buffer-mode "exact" !if @? @# sort-lines !else sort-lines !endif &cond #l0 1 -1 buffer-mode "exact" !emacro
sort-lines-ignore-case(3) is a macro defined in format.emf.
(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12