help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to whip Emacs into weird indentation rules with tabs+spaces?


From: Xah
Subject: Re: How to whip Emacs into weird indentation rules with tabs+spaces?
Date: Fri, 18 Jul 2008 03:04:54 -0700 (PDT)
User-agent: G2/1.0

> The question is, for C++ code, how to make Emacs insert tabs for "main
> indentation" and spaces for "sub-indentation". Example: ..

Maybe someone has thought this up before... but if it comes down to
write your own, here's a suggestion.

Tab key runs the c-indent-command in c mode. So, you might define tab
to run my-own-c-indent.  The command will first check if the beginning
of line is a tab. If so, move to the end of white spaces and insert
spaces. If the beginning of line is a not white-space, then your
command can call the c indent command. you might look up the source
code and borrow pieces...

  Xah
∑ http://xahlee.org/

☄

On Jul 17, 5:35 pm, Juanma <juanma_bel...@yahoo.es> wrote:
> Hi ... again.
>
> The question is, for C++ code, how to make Emacs insert tabs for "main
> indentation" and spaces for "sub-indentation". Example:
>
> |---| = tab     . = space
>
> |---|while ( something &&
> |---|........some_else )
> |---|---|then_do_something();
>
> The idea is that tab goes one level further, but for same-level adjustments
> only spaces should be used.
>
> How to force Emacs into that insanity? (no, it's not my personal choice)
>
> Many thanks.
> --
> Juanma
>
> "Having a smoking section in a restaurant is like
>  having a peeing section in a swimming pool."
>        -- Edward Burr



reply via email to

[Prev in Thread] Current Thread [Next in Thread]