summaryrefslogtreecommitdiff
path: root/lisp/electric.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-11-17 21:01:34 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2013-11-17 21:01:34 -0500
commit25158c76b277cc2787c86c031cfdb5df65efa73f (patch)
tree98a60cdea3533f0af2ddb9fe95d0d63d8e892483 /lisp/electric.el
parent1f35d401baa3e1d5715fecc734e803b538afa257 (diff)
downloademacs-25158c76b277cc2787c86c031cfdb5df65efa73f.tar.gz
* lisp/electric.el (electric-indent-mode-map): Remove.
(electric-indent-mode): Change the global-map instead. Fixes: debbugs:15915
Diffstat (limited to 'lisp/electric.el')
-rw-r--r--lisp/electric.el16
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/electric.el b/lisp/electric.el
index bb93a1615a7..04d0bd3e935 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -273,12 +273,6 @@ mode set `electric-indent-inhibit', but this can be used as a workaround.")
(let ((electric-indent-mode nil))
(newline arg 'interactive)))
-(defvar electric-indent-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map [?\C-j] 'electric-indent-just-newline)
- map)
- "Keymap used for `electric-mode-mode'.")
-
;;;###autoload
(define-minor-mode electric-indent-mode
"Toggle on-the-fly reindentation (Electric Indent mode).
@@ -291,8 +285,14 @@ the hook `electric-indent-functions' returns non-nil, or you
insert a character from `electric-indent-chars'."
:global t :group 'electricity
(if (not electric-indent-mode)
- (remove-hook 'post-self-insert-hook
- #'electric-indent-post-self-insert-function)
+ (progn
+ (when (eq (lookup-key global-map [?\C-j])
+ 'electric-indent-just-newline)
+ (define-key global-map [?\C-j] 'newline-and-indent))
+ (remove-hook 'post-self-insert-hook
+ #'electric-indent-post-self-insert-function))
+ (when (eq (lookup-key global-map [?\C-j]) 'newline-and-indent)
+ (define-key global-map [?\C-j] 'electric-indent-just-newline))
;; 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.