Hello, I am looking for a language independent way to locate the beginning of the enclosing scope. Something along the lines of beginning-of-defun, in that the mode provides a language specific version. My goal is to be able to set up hippie-expand tables that are scoped. A bit more context may help understand my goal. I have templates that grind out code for imperative languages, the classic example being the for loop. I can generate code fragments along with the loop body fairly easily. for ( i , i < array, i++ ) { // elem=array[i] } assuming that the cursor is within the loop body it would be nice to expand "elem" and have it plug in the indexing fragment. Any suggestions appreciated. Thanks, Mike Mattie