all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* c-mode tab is not tabbing
@ 2009-02-05 21:55 rubing
  2009-02-07 15:42 ` Alan Mackenzie
  2009-02-07 15:55 ` Geralt
  0 siblings, 2 replies; 3+ messages in thread
From: rubing @ 2009-02-05 21:55 UTC (permalink / raw)
  To: Help-gnu-emacs


If i press the tab key in the body of the text in order to write a comment or
such it does not work.

The tab key only works at the beginning of the line for only as many tabs as
propper formatting allows.

I want to be able to use tab anywhere.  How can I change this??

Thanks!
-- 
View this message in context: http://www.nabble.com/c-mode-tab-is-not-tabbing-tp21862022p21862022.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c-mode tab is not tabbing
  2009-02-05 21:55 c-mode tab is not tabbing rubing
@ 2009-02-07 15:42 ` Alan Mackenzie
  2009-02-07 15:55 ` Geralt
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2009-02-07 15:42 UTC (permalink / raw)
  To: rubing; +Cc: Help-gnu-emacs

Hi!

On Thu, Feb 05, 2009 at 01:55:31PM -0800, rubing wrote:

> If i press the tab key in the body of the text in order to write a
> comment or such it does not work.

What do you mean by "in order to"?

In Emacs mostly, and definitely in CC Mode, TAB indents the current line
according to its syntax.  So, if you had this

main ()
{
printf ("Hello, Emacs!") ;
}

, and typed TAB on the the long line, it would indent it 4 spaces.
(Actually, typing that last ";" will have triggered automatic
indentation.)

If you want to insert an actual ASCII Tab character, the way to do this
is C-q Tab (that's hold down the control key, press q, leave the control
key, press TAB).  You probably don't "want" to do this, however.

To insert a comment at the end of the current line, you could go there
and type "/* .... */".  Better, just type M-; (that is, whilst holding
down the "meta" (alt) key, type ";").

> The tab key only works at the beginning of the line for only as many
> tabs as proper formatting allows.

There are lots of different values of "proper".  :-)  I'm guessing that
you want the indentation to be done with tabs rather than spaces, as far
as possible.  For this, "customize" `indent-tab-mode' by clicking the
pertinent menu entry, or by typing M-x customize-variable<CR>.

> I want to be able to use tab anywhere.  How can I change this??

You mean, I think, you want pressing the tab key to insert a tab
character (ASCII 9) into your buffer.  First comment, you're probably
mistaken about this.  ;-)  You probably _don't_ want to "use" the tab
key this way (see below).  However, if you did, the way would be to
"bind" the key to the `self-insert-command' command, by writing this into
your .emacs file (that's your primary initialisation file.  If you
haven't got one yet, create it with C-x C-f, then type in "~/.emacs" (no,
don't type the double quote marks)):

    (define-key c-mode-base-map "\C-i" 'self-insert-command)

(don't forget the tick).

However, if you do this, you'll lose the indentation feature of the tab
key.  Question, why do you want to type TABs?

-- 
Alan Mackenzie (Nuremberg, Germany).




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c-mode tab is not tabbing
  2009-02-05 21:55 c-mode tab is not tabbing rubing
  2009-02-07 15:42 ` Alan Mackenzie
@ 2009-02-07 15:55 ` Geralt
  1 sibling, 0 replies; 3+ messages in thread
From: Geralt @ 2009-02-07 15:55 UTC (permalink / raw)
  To: rubing; +Cc: Help-gnu-emacs

On Thu, Feb 5, 2009 at 10:55 PM, rubing <rubinglen@yahoo.com> wrote:
>
> If i press the tab key in the body of the text in order to write a comment or
> such it does not work.
>
> The tab key only works at the beginning of the line for only as many tabs as
> propper formatting allows.
>
> I want to be able to use tab anywhere.  How can I change this??
>
> Thanks!
> --
> View this message in context: http://www.nabble.com/c-mode-tab-is-not-tabbing-tp21862022p21862022.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.
>
>
>
>


By default all indentation is done with whitespace, so if the tab-key
does not indent further, but you think you need to indent further,
just insert spaces until you're satisfied :-)
I suggest to keep the tab-keys current behaviour and to keep
whitespace for indentation, this way your source files look proper on
every editor.




Geralt.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-07 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-05 21:55 c-mode tab is not tabbing rubing
2009-02-07 15:42 ` Alan Mackenzie
2009-02-07 15:55 ` Geralt

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.