diff options
author | João Távora <joaotavora@gmail.com> | 2014-04-13 11:27:32 +0100 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2014-04-13 11:27:32 +0100 |
commit | 498d3768d1109a9bee2aa0207e63db79800627eb (patch) | |
tree | 50602fea2d8bc3c9a7f475f2fbb6bec2e5cc74a3 /lisp/elec-pair.el | |
parent | 834511891e138f284c6e11a2cab34d06670e7052 (diff) | |
download | emacs-498d3768d1109a9bee2aa0207e63db79800627eb.tar.gz emacs-498d3768d1109a9bee2aa0207e63db79800627eb.tar.bz2 emacs-498d3768d1109a9bee2aa0207e63db79800627eb.zip |
Fix bug in Electric Pair mode
* lisp/elec-pair.el (electric-pair--syntax-ppss): Simplify and fix
possible bug.
Diffstat (limited to 'lisp/elec-pair.el')
-rw-r--r-- | lisp/elec-pair.el | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index 04e1840c0a5..42b8a912cc4 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -226,10 +226,9 @@ WHERE is a list defaulting to '(string comment) and indicates when to fallback to `parse-partial-sexp'." (let* ((pos (or pos (point))) (where (or where '(string comment))) - (quick-ppss (syntax-ppss)) - (quick-ppss-at-pos (syntax-ppss pos)) - (in-string (and (nth 3 quick-ppss-at-pos) (memq 'string where))) - (in-comment (and (nth 4 quick-ppss-at-pos) (memq 'comment where))) + (quick-ppss (syntax-ppss pos)) + (in-string (and (nth 3 quick-ppss) (memq 'string where))) + (in-comment (and (nth 4 quick-ppss) (memq 'comment where))) (s-or-c-start (cond (in-string (1+ (nth 8 quick-ppss))) (in-comment @@ -243,7 +242,7 @@ when to fallback to `parse-partial-sexp'." ;; HACK! cc-mode apparently has some `syntax-ppss' bugs (if (memq major-mode '(c-mode c++ mode)) (parse-partial-sexp (point-min) pos) - quick-ppss-at-pos)))) + quick-ppss)))) ;; Balancing means controlling pairing and skipping of parentheses ;; so that, if possible, the buffer ends up at least as balanced as |