joaotavora / autopair

Automagically pair braces and quotes in emacs like TextMate
208 stars 35 forks source link

In js2-mode it can throw a stringp error #21

Closed sherrman closed 10 years ago

sherrman commented 10 years ago

This is the reliable way for me to reproduce this error, in some more simple states it will also start returning errors. Empty file in js2-mode:

function () {
    for [CURSORHERE]
};

With the cursor at [CURSORHERE], open a parenthesis. The function autopair-pair-p returns with a (args-out-of-range 25 49) error created by forward-sexp. The first error handler tries a string compare and craps out with Wrong type argument: stringp, 25.

joaotavora commented 10 years ago

Thanks. This seems easy enough to reproduce. Unfotunately, I have very little time to analyse. Maybe you can find someone who knows elisp to edebug autopair-pair-p and propose a fix.

joaotavora commented 10 years ago

Discussion will continue in the pull request.