Browse files

Closes #3: in `autopair-insert-or-skip-quote`, handle errors without…

… position info.

Not all errors produced `up-list` have the needed `fourth` position arg,
especially when `forward-sexp-function` is used, as is the case of
`nxml-forward-balanced-item`. In those cases, the best we can do is ignore it.

There might be a lot more situations like these, since autopair sometimes
heavily relies on the position info bundled with syntactic movement errors.
  • Loading branch information...
joaotavora committed Aug 16, 2012
1 parent bc9bb4b commit 9ec0ded2695a0aabc6850a452aea2316d350638f
Showing with 4 additions and 3 deletions.
  1. +4 −3 autopair.el
@@ -669,9 +669,10 @@ returned) and uplisting stops there."
(condition-case err
(progn (save-excursion (up-list)) nil)
- (autopair-in-unterminated-string-p (save-excursion
- (goto-char (fourth err))
- (autopair-syntax-ppss)))))
+ (and (fourth err) ;; fix #3
+ (autopair-in-unterminated-string-p (save-excursion
+ (goto-char (fourth err))
+ (autopair-syntax-ppss))))))
(autopair-in-unterminated-string-p (save-excursion
(goto-char (point-max))

0 comments on commit 9ec0ded

Please sign in to comment.