emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114995: * lisp/electric.el (electric-indent-just-ne


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r114995: * lisp/electric.el (electric-indent-just-newline): New command.
Date: Wed, 06 Nov 2013 03:37:07 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114995
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2013-11-05 22:37:03 -0500
message:
  * lisp/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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/electric.el               electric.el-20091113204419-o5vbwnq5f7feedwu-47
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-11-06 02:10:18 +0000
+++ b/lisp/ChangeLog    2013-11-06 03:37:03 +0000
@@ -1,5 +1,10 @@
 2013-11-06  Stefan Monnier  <address@hidden>
 
+       * 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.

=== modified file 'lisp/electric.el'
--- a/lisp/electric.el  2013-11-06 02:10:18 +0000
+++ b/lisp/electric.el  2013-11-06 03:37:03 +0000
@@ -267,6 +267,18 @@
                    (> 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).
@@ -277,7 +289,7 @@
 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)
@@ -427,7 +439,7 @@
 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
@@ -479,7 +491,7 @@
 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]