Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.89 KB | None | 0 0
  1. (defun smart-tab () ;; implement a smarter TAB                                                                                                                                        
  2.   "This smart tab is minibuffer compliant: it acts as usual in the minibuffer.                                                                                                        
  3. Else, if mark is active, indents region. Else if point is at the end of a symbol, expands it.                                                                                        
  4. Else indents the current line."
  5.   (interactive)
  6.   (if (minibufferp)
  7.       (unless (minibuffer-complete)
  8.         (auto-complete)) ;; use auto-complete                                                                                                                                        
  9.         ;; (hippie-expand nil)) ;; use hippie-expand                                                                                                                                  
  10.         ;; (dabbrev-expand nil)) ;; use dabbrev-expand                                                                                                                                
  11.     (if mark-active
  12.         (indent-region (region-beginning)
  13.                        (region-end))
  14.       (if (looking-at "\\_>")
  15.           (auto-complete) ;; use auto-complete                                                                                                                                        
  16.           ;; (hippie-expand nil)) ;; use hippie-expand                                                                                                                                
  17.           ;; (dabbrev-expand nil) ;; use dabbrev-expand                                                                                                                              
  18.         (indent-for-tab-command)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement