sort by column
Joerg Fischer
jf505 at gmx.de
Wed Nov 15 16:58:44 CET 2006
Scott Woodford wrote:
> I like the idea, but its not exactly what I had in mind. I want to do the foll
> owing:
>
> 1. select a section of text to be sorted
> 2. start the sort_by_column() macro, which waits for a mouse click on a column:
> define sort_by_column
> {
> pos = my_wait_for_mouse_click_in_window()
> col = my_get_column(pos)
> filter_selection("sort -k" col)
> }
>
> Is it even possible to wait for a key press or mouse click event during a macro?
No, but I didn't understand what you had in mind because this task
should be done in the following way:
1. Make a rectangular(!) selection of the column you want to
sort by.
2. Start the sort_by_column macro, which is roughly
define sort_by_column {
store $selection_start, $selection_end and $selection_left (= col[umn number])
get the line start and end of the line of $selection_start and _end, respectively
now you can select(start, end) the part of the text to be sorted and
filter_selection("sort -k" col)
}
Cheers,
Jörg
More information about the Discuss
mailing list