diff options
| author | João Távora | 2014-04-13 11:27:32 +0100 |
|---|---|---|
| committer | João Távora | 2014-04-13 11:27:32 +0100 |
| commit | 498d3768d1109a9bee2aa0207e63db79800627eb (patch) | |
| tree | 50602fea2d8bc3c9a7f475f2fbb6bec2e5cc74a3 | |
| parent | 834511891e138f284c6e11a2cab34d06670e7052 (diff) | |
| download | emacs-498d3768d1109a9bee2aa0207e63db79800627eb.tar.gz emacs-498d3768d1109a9bee2aa0207e63db79800627eb.zip | |
Fix bug in Electric Pair mode
* lisp/elec-pair.el (electric-pair--syntax-ppss): Simplify and fix
possible bug.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/elec-pair.el | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 704f7a6d8d8..7f08a133d98 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-04-13 João Távora <joaotavora@gmail.com> | ||
| 2 | |||
| 3 | * elec-pair.el (electric-pair--syntax-ppss): Simplify and fix | ||
| 4 | possible bug. | ||
| 5 | |||
| 1 | 2014-04-13 Eli Zaretskii <eliz@gnu.org> | 6 | 2014-04-13 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * frame.el (blink-cursor-blinks, blink-cursor-blinks-done): Doc fixes. | 8 | * frame.el (blink-cursor-blinks, blink-cursor-blinks-done): Doc fixes. |
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 | |||
| 226 | when to fallback to `parse-partial-sexp'." | 226 | when to fallback to `parse-partial-sexp'." |
| 227 | (let* ((pos (or pos (point))) | 227 | (let* ((pos (or pos (point))) |
| 228 | (where (or where '(string comment))) | 228 | (where (or where '(string comment))) |
| 229 | (quick-ppss (syntax-ppss)) | 229 | (quick-ppss (syntax-ppss pos)) |
| 230 | (quick-ppss-at-pos (syntax-ppss pos)) | 230 | (in-string (and (nth 3 quick-ppss) (memq 'string where))) |
| 231 | (in-string (and (nth 3 quick-ppss-at-pos) (memq 'string where))) | 231 | (in-comment (and (nth 4 quick-ppss) (memq 'comment where))) |
| 232 | (in-comment (and (nth 4 quick-ppss-at-pos) (memq 'comment where))) | ||
| 233 | (s-or-c-start (cond (in-string | 232 | (s-or-c-start (cond (in-string |
| 234 | (1+ (nth 8 quick-ppss))) | 233 | (1+ (nth 8 quick-ppss))) |
| 235 | (in-comment | 234 | (in-comment |
| @@ -243,7 +242,7 @@ when to fallback to `parse-partial-sexp'." | |||
| 243 | ;; HACK! cc-mode apparently has some `syntax-ppss' bugs | 242 | ;; HACK! cc-mode apparently has some `syntax-ppss' bugs |
| 244 | (if (memq major-mode '(c-mode c++ mode)) | 243 | (if (memq major-mode '(c-mode c++ mode)) |
| 245 | (parse-partial-sexp (point-min) pos) | 244 | (parse-partial-sexp (point-min) pos) |
| 246 | quick-ppss-at-pos)))) | 245 | quick-ppss)))) |
| 247 | 246 | ||
| 248 | ;; Balancing means controlling pairing and skipping of parentheses | 247 | ;; Balancing means controlling pairing and skipping of parentheses |
| 249 | ;; so that, if possible, the buffer ends up at least as balanced as | 248 | ;; so that, if possible, the buffer ends up at least as balanced as |