;**************************************************************************** ; ; BRIEF macros to jump forward/backward in source code by indent level ; ; Written by Gene Smilgiewicz, UBM Corporation, NY (212) 889-3898 ; ; ; If these make your editing life any easier and you're a Clipper guy/gal, ; please let me know of any great BRIEF macro(s) you may using ... ; ;**************************************************************************** ; ; I wrote these 'cause it's silly to waste time finding the beginning or end ; of an indented block of code and couldn't find anyone who crossed this ; bridge before me. ; ; ; move_to_end_indent ; ; Moves the cursor down a column until it ; finds a non-whitespace character (space, ; tab, or newline) or winds up at the end ; of the buffer. ; ; ; move_to_start_indent ; ; Moves the cursor up a column until it finds ; a non-whitespace character (as above) or ; winds up on line 1. ; ; ; For these macros to work well for you, assign them to keys that are ; intuitive. I use the following in the macro routine associated with ; my initials: ; ; (assign_to_key "^]" "move_to_end_indent") ; (assign_to_key "^[" "move_to_start_indent") ; ; With these assignments, whenever you want to jump to the end of an ; indented block, position the cursor at the beginning and press Ctrl-]. ; ; Assuming you line up your if/else/endifs or braces, you'll wind up at ; the end of the block (or eof) pretty quickly. With slight modifications ; of the index and read expressions, these puppies can be useful for myriad ; other purposes when dealing with any type of structured text. ; ;**************************************************************************** (macro move_to_end_indent ( (message "Searching next non-blank in column") (move_rel 1 0) ;Modify the index string_to_search if you want ;to ignore formfeed or comment characters too. (while (&& (> (index " \t\n" (read 1)) 0) (! (inq_position))) (move_rel 1 0) ) (message "") ) ) (macro move_to_start_indent ( (int line) (message "Searching previous non-blank in column") (move_rel -1 0) ;Modify the index string_to_search if you want ;to ignore formfeed or comment characters too. (while (> (index " \t\n" (read 1)) 0) ( (inq_position line NULL) (if (== line 1) (break) ) (move_rel -1 0) ) ) (message "") ) )