unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Tabs for indentation, spaces for alignment?
@ 2006-11-06 20:51 Anders Kaseorg
  0 siblings, 0 replies; 8+ messages in thread
From: Anders Kaseorg @ 2006-11-06 20:51 UTC (permalink / raw)


As far as I can tell, Emacs is able to use either only spaces for
indentation and alignment:
        block {
        ....block {
        ........some_really_long_function_name(arg,
        .......................................arg);
or an "optimal" mixture of tabs and spaces for indentation and
alignment:
        block {
        --->block {
        --->--->some_really_long_function_name(arg,
        --->--->--->--->--->--->--->--->--->...arg);
which, of course, might not be so "optimal" to someone with a different
tab width:
        block {
        ----->block {
        ----->----->some_really_long_function_name(arg,
        ----->----->----->----->----->----->----->----->----->...arg);

You may prefer spaces or tabs for indentation, and that's fine, but you
have to agree that using tabs for alignment in this way is broken.  What
I really want is to use tabs for indentation and spaces for alignment:
        block {
        --->block {
        --->--->some_really_long_function_name(arg,
        --->--->...............................arg);
so that the indentation characters are semantically correct, and the
layout is independent of tab width:
        block {
        ----->block {
        ----->----->some_really_long_function_name(arg,
        ----->----->...............................arg);

Is there any way to get this behavior out of Emacs?

Anders

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

* Re: Tabs for indentation, spaces for alignment?
       [not found] <mailman.232.1162848625.2155.help-gnu-emacs@gnu.org>
@ 2006-11-07 10:10 ` Markus Triska
  2006-11-08  4:27   ` Anders Kaseorg
       [not found]   ` <mailman.304.1162960081.2155.help-gnu-emacs@gnu.org>
  2006-12-07  7:09 ` Booted Cat
  2006-12-07  7:09 ` Booted Cat
  2 siblings, 2 replies; 8+ messages in thread
From: Markus Triska @ 2006-11-07 10:10 UTC (permalink / raw)


Anders Kaseorg <anders@kaseorg.com> writes:

> which, of course, might not be so "optimal" to someone with a different
> tab width:

UNIX convention for TAB format effector is to move to columns that are
multiples of 8. People breaking that are on their own.

> You may prefer spaces or tabs for indentation, and that's fine, but you
> have to agree that using tabs for alignment in this way is broken.

It's not. How the TAB character is interpreted has nothing at all to
do with your preferred indent increment.

Best wishes! -- Markus Triska

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

* Re: Tabs for indentation, spaces for alignment?
  2006-11-07 10:10 ` Tabs for indentation, spaces for alignment? Markus Triska
@ 2006-11-08  4:27   ` Anders Kaseorg
       [not found]   ` <mailman.304.1162960081.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Anders Kaseorg @ 2006-11-08  4:27 UTC (permalink / raw)


On Tue, 2006-11-07 at 11:10 +0100, Markus Triska wrote:
> UNIX convention for TAB format effector is to move to columns that are
> multiples of 8. People breaking that are on their own.

I know what UNIX tabs do.  I also know that many Windows editors, and
some cross-platform editors like Eclipse, default to 4-space tabs.  But
let's not have a tab width flame war.  Even if we all agree on 8-space
tabs, I'd want my alignment characters to be semantically correct.

So I ask again: is there a way to get this?
        block {
        ------->block {
        ------->------->some_function(arg,
        ------->------->..............arg);
Or even this, if the indent and tab widths are different?
        block {
        ....block {
        ------->block {
        ------->....some_function(arg,
        ------->..................arg);

Anders

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

* Re: Tabs for indentation, spaces for alignment?
       [not found]   ` <mailman.304.1162960081.2155.help-gnu-emacs@gnu.org>
@ 2006-11-08 14:00     ` Markus Triska
  2006-11-10  7:14       ` Anders Kaseorg
  2006-11-10  8:17     ` don provan
  1 sibling, 1 reply; 8+ messages in thread
From: Markus Triska @ 2006-11-08 14:00 UTC (permalink / raw)


Anders Kaseorg <anders@kaseorg.com> writes:

> is there a way to get this?

Yes, it's possible, though typically not easily (e.g., not by setting
some flag). You'll have to separate alignment from indentation in the
implementations of the modes you want to behave that way. Which ones?

> I'd want my alignment characters to be semantically correct.

Don't confuse indentation with TAB semantics.

Best wishes! -- Markus

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

* Re: Tabs for indentation, spaces for alignment?
  2006-11-08 14:00     ` Markus Triska
@ 2006-11-10  7:14       ` Anders Kaseorg
  0 siblings, 0 replies; 8+ messages in thread
From: Anders Kaseorg @ 2006-11-10  7:14 UTC (permalink / raw)


On Wed, 2006-11-08 at 15:00 +0100, Markus Triska wrote:
> Yes, it's possible, though typically not easily (e.g., not by setting
> some flag). You'll have to separate alignment from indentation in the
> implementations of the modes you want to behave that way. Which ones?

cc-mode and its derivatives, I guess.

I found a link on <http://www.emacswiki.org/cgi-bin/wiki/TabsAreEvil>
supposedly to a cc-mode patch that does what I want, but the link is
broken.

Anders

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

* Re: Tabs for indentation, spaces for alignment?
       [not found]   ` <mailman.304.1162960081.2155.help-gnu-emacs@gnu.org>
  2006-11-08 14:00     ` Markus Triska
@ 2006-11-10  8:17     ` don provan
  1 sibling, 0 replies; 8+ messages in thread
From: don provan @ 2006-11-10  8:17 UTC (permalink / raw)


Anders Kaseorg <anders@kaseorg.com> writes:

> Or even this, if the indent and tab widths are different?
>         block {
>         ....block {
>         ------->block {
>         ------->....some_function(arg,
>         ------->..................arg);

Which would look like this with tab stops set to 4 characters:
         block {
         ....block {
         --->block {
         --->....some_function(arg,
         --->..................arg);

If tabs are broken in your environment (i.e., set to something other
than 8), then you're just hosed: there will always be cases were a tab
character will do the wrong thing. No worries, just tell emacs not to
use them and don't use them manually (internal tabs, for example).

-don provan

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

* Re: Tabs for indentation, spaces for alignment?
       [not found] <mailman.232.1162848625.2155.help-gnu-emacs@gnu.org>
  2006-11-07 10:10 ` Tabs for indentation, spaces for alignment? Markus Triska
@ 2006-12-07  7:09 ` Booted Cat
  2006-12-07  7:09 ` Booted Cat
  2 siblings, 0 replies; 8+ messages in thread
From: Booted Cat @ 2006-12-07  7:09 UTC (permalink / raw)


Caught you again baby!

Anders Kaseorg wrote:
> As far as I can tell, Emacs is able to use either only spaces for
> indentation and alignment:
>         block {
>         ....block {
>         ........some_really_long_function_name(arg,
>         .......................................arg);
> or an "optimal" mixture of tabs and spaces for indentation and
> alignment:
>         block {
>         --->block {
>         --->--->some_really_long_function_name(arg,
>         --->--->--->--->--->--->--->--->--->...arg);
> which, of course, might not be so "optimal" to someone with a different
> tab width:
>         block {
>         ----->block {
>         ----->----->some_really_long_function_name(arg,
>         ----->----->----->----->----->----->----->----->----->...arg);
>
> You may prefer spaces or tabs for indentation, and that's fine, but you
> have to agree that using tabs for alignment in this way is broken.  What
> I really want is to use tabs for indentation and spaces for alignment:
>         block {
>         --->block {
>         --->--->some_really_long_function_name(arg,
>         --->--->...............................arg);
> so that the indentation characters are semantically correct, and the
> layout is independent of tab width:
>         block {
>         ----->block {
>         ----->----->some_really_long_function_name(arg,
>         ----->----->...............................arg);
> 
> Is there any way to get this behavior out of Emacs?
> 
> Anders

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

* Re: Tabs for indentation, spaces for alignment?
       [not found] <mailman.232.1162848625.2155.help-gnu-emacs@gnu.org>
  2006-11-07 10:10 ` Tabs for indentation, spaces for alignment? Markus Triska
  2006-12-07  7:09 ` Booted Cat
@ 2006-12-07  7:09 ` Booted Cat
  2 siblings, 0 replies; 8+ messages in thread
From: Booted Cat @ 2006-12-07  7:09 UTC (permalink / raw)


Caught you again baby!

Anders Kaseorg wrote:
> As far as I can tell, Emacs is able to use either only spaces for
> indentation and alignment:
>         block {
>         ....block {
>         ........some_really_long_function_name(arg,
>         .......................................arg);
> or an "optimal" mixture of tabs and spaces for indentation and
> alignment:
>         block {
>         --->block {
>         --->--->some_really_long_function_name(arg,
>         --->--->--->--->--->--->--->--->--->...arg);
> which, of course, might not be so "optimal" to someone with a different
> tab width:
>         block {
>         ----->block {
>         ----->----->some_really_long_function_name(arg,
>         ----->----->----->----->----->----->----->----->----->...arg);
>
> You may prefer spaces or tabs for indentation, and that's fine, but you
> have to agree that using tabs for alignment in this way is broken.  What
> I really want is to use tabs for indentation and spaces for alignment:
>         block {
>         --->block {
>         --->--->some_really_long_function_name(arg,
>         --->--->...............................arg);
> so that the indentation characters are semantically correct, and the
> layout is independent of tab width:
>         block {
>         ----->block {
>         ----->----->some_really_long_function_name(arg,
>         ----->----->...............................arg);
> 
> Is there any way to get this behavior out of Emacs?
> 
> Anders

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

end of thread, other threads:[~2006-12-07  7:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.232.1162848625.2155.help-gnu-emacs@gnu.org>
2006-11-07 10:10 ` Tabs for indentation, spaces for alignment? Markus Triska
2006-11-08  4:27   ` Anders Kaseorg
     [not found]   ` <mailman.304.1162960081.2155.help-gnu-emacs@gnu.org>
2006-11-08 14:00     ` Markus Triska
2006-11-10  7:14       ` Anders Kaseorg
2006-11-10  8:17     ` don provan
2006-12-07  7:09 ` Booted Cat
2006-12-07  7:09 ` Booted Cat
2006-11-06 20:51 Anders Kaseorg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).