[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Tab-fix"
From: |
Pascal J. Bourguignon |
Subject: |
Re: "Tab-fix" |
Date: |
Tue, 22 Jul 2008 08:54:46 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/22.2 (gnu/linux) |
denebet <denebet@lechebet.bzh> writes:
> I have put the stuff found at
> <http://www.emacsblog.org/2007/03/12/tab-completion-everywhere/>
> in my .emacs to get autocompletion bound to tab in C(++) editing mode while
> keeping the completion of file name in mini-buffers.
>
> (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))
>
> (add-hook 'c-mode-hook 'my-tab-fix)
> (add-hook 'sh-mode-hook 'my-tab-fix)
> (add-hook 'emacs-lisp-mode-hook 'my-tab-fix)
>
> Unfortunately, it seems not to work, at least while editing cpp files.
>
> Any idea ?
In a *.cpp buffer, type: M-: major-mode RET
What do you get?
--
__Pascal Bourguignon__ http://www.informatimago.com/
The rule for today:
Touch my tail, I shred your hand.
New rule tomorrow.
- "Tab-fix", denebet, 2008/07/22
- Re: "Tab-fix",
Pascal J. Bourguignon <=