Defining a "starting line" as a non-blank line which isn't preceded by 
whitespace and isn't just "end", what you want to do is to scan up from the 
current cursor position to the first starting line. Then scan back down to the 
first non-blank line before the next starting line, *or* the first end 
statement without preceding whitespace (whichever comes first).

That will do the right thing in 99% of cases. For that last percent you will 
need a parser, unfortunately, but it's not worth the effort to implement one in 
elisp.

Reply via email to