[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Somtime Emacs have it one life
From: |
Kai Grossjohann |
Subject: |
Re: Somtime Emacs have it one life |
Date: |
Tue, 08 May 2007 13:30:25 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.97 (gnu/linux) |
anders <anders.u.persson@gmail.com> writes:
> I have sett indent, tabs to use tab-char other user have other editors
> and the companystandard it to use tab-chars.
>
> Problem 1 - somtime i want to strycture code with tabs tex.
> char *aShortStuff = NULL;
> char *aLongLongStuff = NULL;
> char *aLongLongLongStuff = NULL;
>
> as
>
> char *aShortStuff = NULL;
> char *aLongLongStuff = NULL;
> char *aLongLongLongStuff = NULL;
One idea is to type M-i instead of TAB. (Mnemonic: TAB is C-i.) M-i
advances to the next tab stop. Tab stops are defined in
tab-stop-list -- use C-h v tab-stop-list RET for more information.
Another idea is to use align.el. Mark these three lines and type M-x
align RET. Or perhaps M-x align-regexp RET = RET.
> This very often Emacs don't like to just sto after 1 tab.
>
> Problem 2 - Emacs stopp using tabchar and start using space
>
> Somtine editing a old function tex
> int calc(int x, int y) {
> int res=0;
This is somewhat complicated. The variable c-basic-offset controls
how many columns does Emacs indent in such a case. The variable
indent-tabs-mode controls whether Emacs uses tab characters (plus
spaces) to move to that column, or just space characters. The
variable tab-width controls how wide a tab character is.
Actually, c-basic-offset is a simplification. See the key combination
C-c C-o for more information. (C-h k C-c C-o or try it.)
All of them need to be set up correctly for your environment. In the
above example, c-basic-offset needs to be 4, indent-tabs-mode needs to
be t, and tab-width needs to be 4. Then the "int res=0;" line will be
indented with a single tab character.
Kai