Created
May 3, 2010 22:13
-
-
Save anonymous/388648 to your computer and use it in GitHub Desktop.
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
;; a modified version from http://www.emacswiki.org/emacs/TabCompletion | |
(defun smart-tab (completion-hook) | |
"This smart tab is minibuffer compliant: it acts as usual in | |
the minibuffer. Else, if mark is active, indents region. Else if | |
point is at the end of a symbol, expands it using the `completion-hook'. | |
Else indents the current line." | |
(interactive) | |
(if (string-match "Minibuf" (buffer-name)) | |
(unless (minibuffer-complete) | |
(dabbrev-expand nil)) | |
(if mark-active | |
(indent-region (region-beginning) | |
(region-end)) | |
(if (looking-at "\\>") | |
(funcall completion-hook) | |
(indent-for-tab-command))))) | |
(add-hook 'clojure-mode-hook | |
(lambda () | |
;; custom keybindings | |
(defun complete-clojure () | |
(interactive) | |
(smart-tab 'slime-complete-symbol)) | |
(local-set-key (kbd "<tab>") 'complete-clojure))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment