2013-11-06 Stefan Monnier <monnier@iro.umontreal.ca>
+ * electric.el (electric-indent-just-newline): New command.
+ (electric-indent-mode-map): New keymap.
+ (electric-indent-mode, electric-pair-mode, electric-layout-mode):
+ Re-add :group which weren't redundant.
+
* electric.el (electric-indent-local-mode): New minor mode.
(electric-indent-functions-without-reindent): New var.
(electric-indent-post-self-insert-function): Use it.
(> pos (line-beginning-position)))
(indent-according-to-mode)))))
+(defun electric-indent-just-newline (arg)
+ "Insert just a newline, without any auto-indentation."
+ (interactive "*P")
+ (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).
This is a global minor mode. When enabled, it reindents whenever
the hook `electric-indent-functions' returns non-nil, or you
insert a character from `electric-indent-chars'."
- :global t
+ :global t :group 'electricity
(if (not electric-indent-mode)
(remove-hook 'post-self-insert-hook
#'electric-indent-post-self-insert-function)
closing parenthesis. \(Likewise for brackets, etc.)
See options `electric-pair-pairs' and `electric-pair-skip-self'."
- :global t
+ :global t :group 'electricity
(if electric-pair-mode
(progn
(add-hook 'post-self-insert-hook
positive, and disable it otherwise. If called from Lisp, enable
the mode if ARG is omitted or nil.
The variable `electric-layout-rules' says when and how to insert newlines."
- :global t
+ :global t :group 'electricity
(if electric-layout-mode
(add-hook 'post-self-insert-hook
#'electric-layout-post-self-insert-function)