Powered By Blogger

Bu Blogda Ara

24 Aralık 2009 Perşembe

Emacs Python mode

Emacs python-mode için TAB ile indentation yapan bir function paylaşayım sizinle.

.emacs dosyanızın içine şu fonksiyonu ekleyin evvela bi??

 
(defun indent-or-expand (arg)
"Either indent according to mode, or expand the word preceding point."
(interactive "*P")
(if (and
(or (bobp) (= ?w (char-syntax (char-before))))
(or (eobp) (not (= ?w (char-syntax (char-after))))))
(dabbrev-expand arg)
(indent-according-to-mode)))

(defun my-tab-fix ()
(local-set-key [tab] 'indent-or-expand))



Sonra hook'unuzu ekleyin.

(add-hook 'python-mode-hook 'my-tab-fix)

That's it.

Bol emacs'li def __init__()'li günler.

Hiç yorum yok: