[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tab within comments in C/C++ mode
From: |
Henrik Enberg |
Subject: |
Re: Tab within comments in C/C++ mode |
Date: |
Wed, 30 Oct 2002 22:34:15 +0100 |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu) |
"Chris Hobbs" <code_wraith@sbcglobal.net> writes:
> I am looking for a way to allow the tab key while inside comments in C and
> C++ mode. Currently, the mode will not allow a tab (let alone multiple
> tabs) to be placed while in a comment. It seems to insist on formatting
> the contents of the comment. Not really formatting per se, mainly just
> disallowing any format I want to put in there.
`C-q TAB' should do what you want. C-q runs `quoted-insert' which
insets the next thing you type verbatim.
If you think that is annoying you could try putting this (untested) code
in ~/.emacs.el
(add-hook 'post-command-hook
(lambda ()
(when (memq major-mode '(c-mode c++-mode java-mode))
(if (eq (get-text-property (point) 'face)
'font-lock-comment-face)
(local-set-key (kbd "<tab>") 'tab-to-tab-stop)
(local-set-key (kbd "<tab>") 'c-indent-command)))))
--
Booting... /vmemacs.el