動的略語展開とインデント

を、TABキーでやりたかったので、なんかうまい方法ないのかな?
と、いろいろ。
EmacsWiki: Tab Completionにindent-or-completeなどあったので、流用させてもらう。

(require 'anything-dabbrev-expand)

(defun indent-or-complete ()
 "Complete if point is at end of a word, otherwise indent line."
 (interactive)
 (if (looking-at "\\>")
     (anything-dabbrev-expand)
   (indent-for-tab-command)
   ))

(global-set-key "\t" 'indent-or-complete)
;;(global-set-key "\t" 'anything-dabbrev-expand)
(define-key anything-dabbrev-map "\t" 'anything-dabbrev-find-all-buffers)

しかしうまくいかない。
anything-dabbrev-expandが段階を踏んで候補を表示する関係かなぁ。。。とかぼんやりと考え、
とりあえず、いきなり最終段階に行くようにした。

(require 'anything-dabbrev-expand)

(setq anything-dabbrev-expand-strategies
    '(anything-dabbrev-expand--anything))

(defun indent-or-complete ()
 "Complete if point is at end of a word, otherwise indent line."
 (interactive)
 (if (looking-at "\\>")
     (anything-dabbrev-expand)
   (indent-for-tab-command)
   ))

(global-set-key "\t" 'indent-or-complete)
;;(global-set-key "\t" 'anything-dabbrev-expand)
(define-key anything-dabbrev-map "\t" 'anything-dabbrev-find-all-buffers)

とりあえずうまくいったりいいかな?