Skip to content

Instantly share code, notes, and snippets.

/gist:388648
Created May 3, 2010

Embed
What would you like to do?
;; 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
You can’t perform that action at this time.