First attempt at fixing bug #289

I hope I didn't break anything. It seems to work in latex, but a similar bug happens with sgml tags, and this doesn't fix it (I suspect it is because the `<` is considered the opening pair of the `</foo>` tag).

If `sp-get-thing` is a slow function, then this "fix" is also highly non-optimized. There is probably a better way to check that we are at the beginning of a sexp anyway.