summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2013-05-18 11:55:06 +0100
committerAlan Pearce2013-05-18 11:55:06 +0100
commit011f317d2faf190cfdd4074e1ada771acab4c975 (patch)
tree68a6d5d9dd64ad982223639f1a344ea4d4492f33
parent883b3a15157eca87580006c4a004a8e46b075e2c (diff)
downloaddotfiles-011f317d2faf190cfdd4074e1ada771acab4c975.tar.lz
dotfiles-011f317d2faf190cfdd4074e1ada771acab4c975.tar.zst
dotfiles-011f317d2faf190cfdd4074e1ada771acab4c975.zip
Emacs: Remove electrify-return-if-match and replace with paredit keybindings in lisp-modes
-rw-r--r--emacs/elisp/electric-return.el16
-rw-r--r--emacs/init.el7
2 files changed, 1 insertions, 22 deletions
diff --git a/emacs/elisp/electric-return.el b/emacs/elisp/electric-return.el
deleted file mode 100644
index fcbebb3..0000000
--- a/emacs/elisp/electric-return.el
+++ /dev/null
@@ -1,16 +0,0 @@
-(defvar electrify-return-match
-  "[\]}\)\"]"
-  "If this regexp matches the text after the cursor, do an \"electric\"
-  return.")
-(defun electrify-return-if-match (arg)
-  "If the text after the cursor matches `electrify-return-match' then
-  open and indent an empty line between the cursor and the text.  Move the
-  cursor to the new line."
-  (interactive "P")
-  (let ((case-fold-search nil))
-    (if (looking-at electrify-return-match)
-        (save-excursion (newline-and-indent)))
-    (newline arg)
-    (indent-according-to-mode)))
-;; Using local-set-key in a mode-hook is a better idea.
-;(global-set-key (kbd "RET") 'electrify-return-if-match)
\ No newline at end of file
diff --git a/emacs/init.el b/emacs/init.el
index b0fefcf..af79db7 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -786,9 +786,6 @@ Also returns nil if pid is nil."
           (setq autopair-blink nil
                 autopair-skip-whitespace nil)))
 
-(use-package electric-return
-  :bind (("RET" . electrify-return-if-match)))
-
 (use-package expand-region
   :bind ("C-M-SPC" . er/expand-region))
 
@@ -855,9 +852,7 @@ Also returns nil if pid is nil."
 
   (show-paren-mode t)
   (setq indent-tabs-mode nil)
-
-  (local-set-key (kbd "RET") 'electrify-return-if-match)
-  (local-set-key (kbd "C-j") 'electrify-return-if-match))
+  (local-set-key (kbd "RET") #'paredit-newline))
 
 (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup)
 (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode)