diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-11-20 01:29:57 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-11-20 01:29:57 -0500 |
commit | 24f3d7b94b364021df18c43c3e7fe4211974ccf9 (patch) | |
tree | 00b66db784eea6132a6301fbec3db521ae6d7d1e | |
parent | a5bb9bd3a83d7a357b5e2ca0929efcb420197268 (diff) | |
download | emacs-24f3d7b94b364021df18c43c3e7fe4211974ccf9.tar.gz emacs-24f3d7b94b364021df18c43c3e7fe4211974ccf9.tar.bz2 emacs-24f3d7b94b364021df18c43c3e7fe4211974ccf9.zip |
* lisp/electric.el (electric-indent-mode): Fix last change (too optimistic).
-rw-r--r-- | lisp/ChangeLog | 2 | ||||
-rw-r--r-- | lisp/electric.el | 26 |
2 files changed, 19 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e79af3ae2e8..e6f1bc55bf2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2011-11-20 Stefan Monnier <monnier@iro.umontreal.ca> + * electric.el (electric-indent-mode): Fix last change (too optimistic). + * emacs-lisp/bytecomp.el: Silence obsolete warnings more reliably. (byte-compile-global-not-obsolete-vars): New var. (byte-compile-check-variable, byte-compile-make-obsolete-variable): diff --git a/lisp/electric.el b/lisp/electric.el index 69acb773648..657b577bb1e 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -260,15 +260,23 @@ reindentation is triggered whenever you insert a character listed in `electric-indent-chars'." :global t :group 'electricity - (if electric-indent-mode - (add-hook 'post-self-insert-hook - #'electric-indent-post-self-insert-function - ;; post-self-insert-hooks interact in non-trivial ways. - ;; It turns out that electric-indent-mode generally works - ;; better last. - 'append) - (remove-hook 'post-self-insert-hook - #'electric-indent-post-self-insert-function))) + (if (not electric-indent-mode) + (remove-hook 'post-self-insert-hook + #'electric-indent-post-self-insert-function) + ;; post-self-insert-hooks interact in non-trivial ways. + ;; It turns out that electric-indent-mode generally works better if run + ;; late, but still before blink-paren. + (add-hook 'post-self-insert-hook + #'electric-indent-post-self-insert-function + 'append) + ;; FIXME: Ugly! + (let ((bp (memq #'blink-paren-post-self-insert-function + (default-value 'post-self-insert-hook)))) + (when (memq #'electric-indent-post-self-insert-function bp) + (setcar bp #'electric-indent-post-self-insert-function) + (setcdr bp (cons #'blink-paren-post-self-insert-function + (delq #'electric-indent-post-self-insert-function + (cdr bp)))))))) ;; Electric pairing. |