[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
DWIM for the TAB key
From: |
Oliver Scholz |
Subject: |
DWIM for the TAB key |
Date: |
Wed, 16 Feb 2005 02:42:04 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
Reading a thread on emacs-devel, I thought that maybe others would
also like what I have been using for quite a while:
(defun egoge-tab-dwim ()
"Indent or complete depending on the context.
If point is at the beginning of a line or if all characters
between point and the beginning of the line are whitespace
characters, indent that line. Otherwise complete the symbol at
point."
(interactive)
(if (or (bolp)
(save-excursion (backward-char 1)
(looking-at "[[:blank:]]")))
(indent-according-to-mode)
(if (memq major-mode '(emacs-lisp-mode
lisp-interaction-mode
inferior-emacs-lisp-mode))
(lisp-complete-symbol)
(complete-symbol))))
(define-key global-map [tab] 'egoge-tab-dwim)
Oliver
--
28 Pluviôse an 213 de la Révolution
Liberté, Egalité, Fraternité!
- DWIM for the TAB key,
Oliver Scholz <=