Replace electric-indent-mode and paredit with smartparens

This commit is contained in:
Bozhidar Batsov 2013-06-29 11:09:16 +03:00
parent f76aab7491
commit 427bc31866
5 changed files with 15 additions and 16 deletions

View file

@ -100,7 +100,8 @@ With a prefix ARG open line above the current line."
(prelude-smart-open-line-above) (prelude-smart-open-line-above)
(progn (progn
(move-end-of-line nil) (move-end-of-line nil)
(newline-and-indent)))) (newline-and-indent)
(shit))))
(defun prelude-top-join-line () (defun prelude-top-join-line ()
"Join the current line with the line beneath it." "Join the current line with the line beneath it."
@ -321,12 +322,12 @@ the current buffer."
(interactive) (interactive)
(insert (format-time-string "%c" (current-time)))) (insert (format-time-string "%c" (current-time))))
(defun prelude-conditionally-enable-paredit-mode () ;; (defun prelude-conditionally-enable-paredit-mode ()
"Enable `paredit-mode' in the minibuffer, during `eval-expression'." ;; "Enable `paredit-mode' in the minibuffer, during `eval-expression'."
(if (eq this-command 'eval-expression) ;; (if (eq this-command 'eval-expression)
(paredit-mode 1))) ;; (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 () (defun prelude-recentf-ido-find-file ()
"Find a recent file using ido." "Find a recent file using ido."

View file

@ -102,7 +102,9 @@ Will only occur if prelude-whitespace is also enabled."
try-complete-lisp-symbol)) try-complete-lisp-symbol))
;; smart pairing for all ;; 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 ;; diminish keeps the modeline tidy
(require 'diminish) (require 'diminish)

View file

@ -46,7 +46,7 @@
git-commit-mode gitconfig-mode gitignore-mode git-commit-mode gitconfig-mode gitignore-mode
guru-mode helm helm-projectile ido-ubiquitous guru-mode helm helm-projectile ido-ubiquitous
key-chord magit melpa rainbow-mode key-chord magit melpa rainbow-mode
smex solarized-theme undo-tree smartparens smex solarized-theme undo-tree
volatile-highlights yasnippet zenburn-theme) volatile-highlights yasnippet zenburn-theme)
"A list of packages to ensure are installed at launch.") "A list of packages to ensure are installed at launch.")

View file

@ -33,29 +33,24 @@
;;; Code: ;;; Code:
(require 'prelude-programming) (require 'prelude-programming)
(prelude-ensure-module-deps '(paredit rainbow-delimiters)) (prelude-ensure-module-deps '(rainbow-delimiters))
;; Lisp configuration ;; Lisp configuration
(define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) (define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol)
;; a great lisp coding hook ;; a great lisp coding hook
(defun prelude-lisp-coding-defaults () (defun prelude-lisp-coding-defaults ()
(paredit-mode +1)
(rainbow-delimiters-mode +1)) (rainbow-delimiters-mode +1))
(setq prelude-lisp-coding-hook 'prelude-lisp-coding-defaults) (setq prelude-lisp-coding-hook 'prelude-lisp-coding-defaults)
;; interactive modes don't need whitespace checks ;; interactive modes don't need whitespace checks
(defun prelude-interactive-lisp-coding-defaults () (defun prelude-interactive-lisp-coding-defaults ()
(paredit-mode +1)
(rainbow-delimiters-mode +1) (rainbow-delimiters-mode +1)
(whitespace-mode -1)) (whitespace-mode -1))
(setq prelude-interactive-lisp-coding-hook 'prelude-interactive-lisp-coding-defaults) (setq prelude-interactive-lisp-coding-hook 'prelude-interactive-lisp-coding-defaults)
(eval-after-load "paredit"
'(diminish 'paredit-mode " π"))
(provide 'prelude-lisp) (provide 'prelude-lisp)
;;; prelude-lisp.el ends here ;;; prelude-lisp.el ends here

View file

@ -33,7 +33,9 @@
;;; Code: ;;; Code:
(require 'prelude-programming) (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. ;; Rake files are ruby, too, as are gemspecs, rackup files, and gemfiles.
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode)) (add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
@ -59,7 +61,6 @@
(inf-ruby-setup-keybindings) (inf-ruby-setup-keybindings)
;; turn off the annoying input echo in irb ;; turn off the annoying input echo in irb
(setq comint-process-echoes t) (setq comint-process-echoes t)
(ruby-end-mode +1)
(ruby-tools-mode +1) (ruby-tools-mode +1)
;; CamelCase aware editing operations ;; CamelCase aware editing operations
(subword-mode +1)) (subword-mode +1))