Created
January 30, 2017 15:22
-
-
Save frankyxhl/d48f1ee33e6af8c419d643ccfd02dd5b to your computer and use it in GitHub Desktop.
fast-paren-space
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Fast paren mode 1.0 | |
;; Copyright(C) 2012, CrLF0710 | |
;; Please use this code under BSD license | |
(defun fast-paren-space () | |
(interactive) | |
(if (member (preceding-char) '(0 9 10 32 40)) | |
(if (and (symbol-value 'paredit-mode) | |
(symbol-function 'paredit-open-round)) | |
(funcall 'paredit-open-round) | |
(insert-char ?\( 1)) | |
(insert-char ?\ 1))) | |
(defun fast-paren-space-normal () | |
(interactive) | |
(insert-char ?\ 1)) | |
(define-minor-mode fast-paren-mode | |
"Toggle fast-paren-mode. | |
With no argument, this command toggles the mode. | |
Non-null prefix argument turns on the mode. | |
Null prefix argument turns off the mode. | |
When fast-paren-mode is enabled, Multiple spaces will be | |
interpreted into a space and multiple left brackets" | |
nil | |
" Fast-Paren" | |
'((" " . fast-paren-space) | |
("\M- " . fast-paren-space-normal))) | |
(defun turn-on-fast-paren-mode () | |
"Turn on fast-paren-mode (see command `fast-paren-mode')." | |
(interactive) | |
(fast-paren-mode 1)) | |
(provide 'fast-paren-mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fast-paren-mode 1.0
created by CrLF0710
Install: put fast-paren-mode.el into site-lisp folder,and then load it in your .emacs configure file.
(Turn On/Off:M-x fast-paren-mode)
;; fast-paren-mode
(require 'fast-paren-mode)
(add-hook 'lisp-mode-hook 'turn-on-fast-paren-mode)
(add-hook 'emacs-lisp-mode-hook 'turn-on-fast-paren-mode)
(add-hook 'ielm-mode-hook 'turn-on-fast-paren-mode)
(add-hook 'lisp-interaction-mode-hook 'turn-on-fast-paren-mode)
(add-hook 'slime-repl-mode-hook 'turn-on-fast-paren-mode)