Skip to content

Commit

Permalink
emacs: auto pair added
Browse files Browse the repository at this point in the history
  • Loading branch information
sjbalaji committed May 31, 2013
1 parent b90aec0 commit dfd2859
Show file tree
Hide file tree
Showing 2 changed files with 1,164 additions and 1 deletion.
23 changes: 22 additions & 1 deletion emacs
Expand Up @@ -358,4 +358,25 @@
(load-file "~/.emacs.d/color-theme-cobalt-0.0.2/color-theme-cobalt.el")
(if window-system
(color-theme-cobalt))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Autopair the paranthesis :P
(load-file "~/.emacs.d/autopair.el")
(defun autopair-close-block (arg)
(interactive "P")
(cond
(mark-active
(autopair-close arg))
((not (looking-back "^[[:space:]]*"))
(newline-and-indent)
(autopair-close arg))
(t
(autopair-close arg))))
(add-hook 'c-mode-common-hook
'(lambda ()
(local-set-key "(" 'autopair-insert)
(local-set-key ")" 'autopair-insert)
(local-set-key "{" 'autopair-insert)
(local-set-key "}" 'autopair-close-block)))
(require 'autopair)
(autopair-global-mode) ;; enable autopair in all buffers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

0 comments on commit dfd2859

Please sign in to comment.