Browse files

Don't fail when syntax entry is missing for closing parens

In the case of some buffers, e.g. `*urlparse-temp*`, there is no syntax entry for closing parens. When trying to enable `autopair-global-mode` with such buffers open, an error results due to autopair assuming there is such an entry. This commit prevents that error by binding 'autopair-skip-close-maybe only if such a syntax entry exists.

(This behavior was observed in Emacs 24.)
  • Loading branch information...
1 parent 71a72d3 commit ea9472b73d422abe4df219c41f519515fb00ce93 @purcell committed Jul 22, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 autopair.el
3 autopair.el
@@ -412,7 +412,8 @@ syntax table and the local value of `autopair-extra-pairs'."
(cond ((eq class (car (string-to-syntax "(")))
;; syntax classes "opening parens" and "close parens"
(define-key map (string char) 'autopair-insert-opening)
- (define-key map (string pair) 'autopair-skip-close-maybe))
+ (when pair
+ (define-key map (string pair) 'autopair-skip-close-maybe)))
((eq class (car (string-to-syntax "\"")))
;; syntax class "string quote
(define-key map (string char) 'autopair-insert-or-skip-quote))

0 comments on commit ea9472b

Please sign in to comment.