From: Tim X <timx@nospam.dev.null>
To: help-gnu-emacs@gnu.org
Subject: Re: change spaces indent in text mode?
Date: Sun, 07 Feb 2010 14:31:58 +1100 [thread overview]
Message-ID: <877hqp7mc1.fsf@lion.rapttech.com.au> (raw)
In-Reply-To: 87fx5d7tr9.fsf@lion.rapttech.com.au
Responding to myself to correct some errors and my misreading of the
post!
Tim X <timx@nospam.dev.null> writes:
> Jorgen Grahn <grahn+nntp@snipabacken.se> writes:
>
>> On Fri, 2010-01-29, Tom Rauchenwald wrote:
>>> Brendan Miller <catphive@catphive.net> writes:
>>>
>>>> Great, thanks!
>>>>
>>>> The only problem I have, is that m-i seems to indent by 8 spaces. I
>>>> tried putting
>>>>
>>>> (setq tab-width 4) in my .emacs, but that doesn't seem to change
>>>> anything... is m-i controlled by a different variable?
>>>
>>> Try (setq-default tab-width 4)
>>
>> A few people have suggested this. Note that this redefines the
>> appearance *in your Emacs* of the TAB character and the text as a
>> whole. It will look wrong in any other program and to any other reader
>> who hasn't reconfigured his tools in the same way.
>>
>> I have the misfortune of working with source code where half of it
>> uses this configuration and half doesn't. It's pure pain; please
>> don't do it unless you *know* noone but you will ever have to read
>> this text.
>>
>
> Sorry, but I think you have things upside down. The problem you describe
> is not due to people modifying tab width, but rather inconsistent use of
> tabs.
>
On reading this back, I think I may have misunderstood what you were
saying and want to clarify.
Having a mixture of indents which use spaces and indents that use tabs
DOES make life difficult. However, I don't believe changing the variable
default-tab-widthh affects whether tabs are used or spaces. The variable that
determines this is indent-tabs-mode. If this is set to nil, spaces will
be used instead of tabs. Changing default-tab-width only affects the
display width of tabs i.e. how many spaces used to represent a tab and
does nnot affect whether tabs are used or spaces. i.e. it only affects
how things are displayed and not what characters are inserted intot he
buffer.
> If everyone you had to work with used tabs, then it would be possible to
> realise one of the great benefits of tabs. That is, we could all have
> the amount of indent that we want, 2 spaces, 4, 8 10 whatever and it
> wouldn't matter.
Which, when re-reading the message I was responding to, would appear to
be what the author was saying. Saying that changing tab width would
change from using tabs to spaces is what mixed me up. i.e. Jorgen is
correct that mixing tabs and spaces to do indenting creates a
maintenance mess. However, I bleieve he is incorrect in stating that
changing default tab width will cause spaces to be used instead of a tab char.
>
> If we insist on everyone having the same width tab stops, then really,
> we have lost the benefit of tab and can just use spaces. In fact, if you
> are having problems because of inconsistent use of tabs/spaces maybe the
> solution is to have emacs convert all spaces to tabs and only use spaces
> when you hit the tab key or have emacs convert all leading spaces to
> tabs so that you don't get the mixture. There is a downside in doing
> this if you are in a team using version control if your VC isn't
> configured correctly as the changes will be seen as changes in content
> rather than just changes in whitespace styles.
>
Sheez, I'm not having a good day. To try and clarify. I believe it is
possible to have emacs automatically convert leading spaces into tabs
automatically and it is probably possible to have it convert back the
other way when saving files. theoretically, it should be possible to set
things up so that a mixture of indents using tabs and spaces is less of
a pain. If you convert all instances of n space characters to a tab, you
could have emacs largely deal with the pain of mixed indent styles for
you. If others in your team insist on spaces instaed of tabs (which I
think is a mistake!), you can have emacs translate all your tabs to
spaces before saving. This could give you the best of both worlds. When
editing the file, inent can be tab based and you can change the amount
(size) of the indent by changing the default tab width. To avoid
arguments with your colleagues, you can then automatically convert tabs
back to spaces before saving and putting the file into version control.
Hope that clarifies more than cnfuses!
Tim
--
tcross (at) rapttech dot com dot au
next prev parent reply other threads:[~2010-02-07 3:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.440.1264793480.14305.help-gnu-emacs@gnu.org>
2010-01-29 19:39 ` change spaces indent in text mode? Teemu Likonen
2010-01-29 20:50 ` Brendan Miller
2010-01-29 21:22 ` Tom Rauchenwald
2010-01-30 0:51 ` Brendan Miller
2010-01-30 1:56 ` Suvayu Ali
2010-01-29 21:30 ` Tyler Smith
[not found] ` <mailman.444.1264800653.14305.help-gnu-emacs@gnu.org>
2010-02-01 17:07 ` Stefan Monnier
[not found] ` <mailman.447.1264801240.14305.help-gnu-emacs@gnu.org>
2010-02-06 8:11 ` Jorgen Grahn
2010-02-07 0:51 ` Tim X
2010-02-07 3:31 ` Tim X [this message]
2010-02-08 2:14 ` Stefan Monnier
[not found] ` <mailman.443.1264798210.14305.help-gnu-emacs@gnu.org>
2010-01-30 2:39 ` Tim X
2010-01-30 21:59 ` Glauber Alex Dias Prado
[not found] ` <mailman.477.1264888760.14305.help-gnu-emacs@gnu.org>
2010-01-30 23:06 ` Tim X
2010-01-31 2:05 ` Suvayu Ali
[not found] ` <mailman.482.1264903543.14305.help-gnu-emacs@gnu.org>
2010-02-01 17:04 ` Stefan Monnier
2010-02-02 1:32 ` Suvayu Ali
2010-02-06 8:21 ` Jorgen Grahn
2010-02-07 7:23 ` Suvayu Ali
2010-01-29 19:28 Brendan Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877hqp7mc1.fsf@lion.rapttech.com.au \
--to=timx@nospam.dev.null \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.