From 427bc318668498fb3dc1c1e6701a0ddb83c946f2 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sat, 29 Jun 2013 11:09:16 +0300 Subject: [PATCH] Replace electric-indent-mode and paredit with smartparens --- core/prelude-core.el | 13 +++++++------ core/prelude-editor.el | 4 +++- core/prelude-packages.el | 2 +- modules/prelude-lisp.el | 7 +------ modules/prelude-ruby.el | 5 +++-- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index a6c9efe..9cc8fbc 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -100,7 +100,8 @@ With a prefix ARG open line above the current line." (prelude-smart-open-line-above) (progn (move-end-of-line nil) - (newline-and-indent)))) + (newline-and-indent) + (shit)))) (defun prelude-top-join-line () "Join the current line with the line beneath it." @@ -321,12 +322,12 @@ the current buffer." (interactive) (insert (format-time-string "%c" (current-time)))) -(defun prelude-conditionally-enable-paredit-mode () - "Enable `paredit-mode' in the minibuffer, during `eval-expression'." - (if (eq this-command 'eval-expression) - (paredit-mode 1))) +;; (defun prelude-conditionally-enable-paredit-mode () +;; "Enable `paredit-mode' in the minibuffer, during `eval-expression'." +;; (if (eq this-command 'eval-expression) +;; (paredit-mode 1))) -(add-hook 'minibuffer-setup-hook 'prelude-conditionally-enable-paredit-mode) +;; (add-hook 'minibuffer-setup-hook 'prelude-conditionally-enable-paredit-mode) (defun prelude-recentf-ido-find-file () "Find a recent file using ido." diff --git a/core/prelude-editor.el b/core/prelude-editor.el index 3de96b8..345c788 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -102,7 +102,9 @@ Will only occur if prelude-whitespace is also enabled." try-complete-lisp-symbol)) ;; smart pairing for all -(electric-pair-mode t) +(setq sp-base-key-bindings 'paredit) +(require 'smartparens-config) +(smartparens-global-mode +1) ;; diminish keeps the modeline tidy (require 'diminish) diff --git a/core/prelude-packages.el b/core/prelude-packages.el index 0d656b5..f6d7d2b 100644 --- a/core/prelude-packages.el +++ b/core/prelude-packages.el @@ -46,7 +46,7 @@ git-commit-mode gitconfig-mode gitignore-mode guru-mode helm helm-projectile ido-ubiquitous key-chord magit melpa rainbow-mode - smex solarized-theme undo-tree + smartparens smex solarized-theme undo-tree volatile-highlights yasnippet zenburn-theme) "A list of packages to ensure are installed at launch.") diff --git a/modules/prelude-lisp.el b/modules/prelude-lisp.el index 1dac0af..7bc6860 100644 --- a/modules/prelude-lisp.el +++ b/modules/prelude-lisp.el @@ -33,29 +33,24 @@ ;;; Code: (require 'prelude-programming) -(prelude-ensure-module-deps '(paredit rainbow-delimiters)) +(prelude-ensure-module-deps '(rainbow-delimiters)) ;; Lisp configuration (define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) ;; a great lisp coding hook (defun prelude-lisp-coding-defaults () - (paredit-mode +1) (rainbow-delimiters-mode +1)) (setq prelude-lisp-coding-hook 'prelude-lisp-coding-defaults) ;; interactive modes don't need whitespace checks (defun prelude-interactive-lisp-coding-defaults () - (paredit-mode +1) (rainbow-delimiters-mode +1) (whitespace-mode -1)) (setq prelude-interactive-lisp-coding-hook 'prelude-interactive-lisp-coding-defaults) -(eval-after-load "paredit" - '(diminish 'paredit-mode " π")) - (provide 'prelude-lisp) ;;; prelude-lisp.el ends here diff --git a/modules/prelude-ruby.el b/modules/prelude-ruby.el index 0f8a085..f71ed25 100644 --- a/modules/prelude-ruby.el +++ b/modules/prelude-ruby.el @@ -33,7 +33,9 @@ ;;; Code: (require 'prelude-programming) -(prelude-ensure-module-deps '(ruby-tools inf-ruby yari ruby-end)) +(require 'smartparens-ruby) + +(prelude-ensure-module-deps '(ruby-tools inf-ruby yari)) ;; Rake files are ruby, too, as are gemspecs, rackup files, and gemfiles. (add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode)) @@ -59,7 +61,6 @@ (inf-ruby-setup-keybindings) ;; turn off the annoying input echo in irb (setq comint-process-echoes t) - (ruby-end-mode +1) (ruby-tools-mode +1) ;; CamelCase aware editing operations (subword-mode +1))