Skip to content

Instantly share code, notes, and snippets.

@frankyxhl
Created April 9, 2015 15:24
Show Gist options
  • Save frankyxhl/9af84ab466306eac88f1 to your computer and use it in GitHub Desktop.
Save frankyxhl/9af84ab466306eac88f1 to your computer and use it in GitHub Desktop.
;; Webpage: http://emacswiki.org/emacs/ParEdit
(require 'paredit)
(add-hook 'emacs-lisp-mode-hook (lambda () (paredit-mode 1)))
(add-hook 'lisp-mode-hook (lambda () (paredit-mode 1)))
(add-hook 'lisp-interaction-mode-hook (lambda () (paredit-mode 1)))
(add-hook 'python-mode-hook (lambda () (paredit-mode 1)))
(add-hook 'scheme-mode-hook (lambda () (paredit-mode 1)))
(add-hook 'clojure-mode-hook (lambda () (paredit-mode 1)))
;;https://github.com/grettke/parenface
(require 'parenface)
(eval-after-load 'parenface
(progn
(set-face-foreground 'parenface-paren-face "SteelBlue4")
(set-face-foreground 'parenface-bracket-face "SteelBlue4")
(set-face-foreground 'parenface-curly-face "SteelBlue4")))
(setq show-paren-delay 0)
;; Webpage: http://www.emacswiki.org/emacs/HighlightParentheses
(require 'highlight-parentheses)
(define-globalized-minor-mode global-highlight-parentheses-mode
highlight-parentheses-mode
(lambda ()
(highlight-parentheses-mode t)))
(global-highlight-parentheses-mode t)
;; swap () and [] keys
(define-key key-translation-map [?\(] [?\[])
(define-key key-translation-map [?\[] [?\(])
(define-key key-translation-map [?\)] [?\]])
(define-key key-translation-map [?\]] [?\)])
;; Stop SLIME's REPL from grabbing DEL,
;; which is annoying when backspacing over a '('
(defun override-slime-repl-bindings-with-paredit ()
(define-key slime-repl-mode-map
(read-kbd-macro paredit-backward-delete-key) nil))
(add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment