all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* spaces before tabs (yuck!)
@ 2015-11-04  0:10 Hikaru Ichijyo
  2015-11-04  0:24 ` Kaushal Modi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Hikaru Ichijyo @ 2015-11-04  0:10 UTC (permalink / raw)
  To: help-gnu-emacs

The question of tabs versus spaces is so notorious, it has its own
chapter in the Emacs manual.  Some people hate the confusion that tabs
cause them so much that they set indent-tabs-mode nil to make it so only
spaces are ever used, and there are no tabs anywhere.

I don't want to do that.  I just want to make it so Emacs will never
insert spaces unless the next character is either a visible/printable
one, or it is the end of the line.  In other words, no spaces before
tabs.

Recent versions of Nano actually highlight this in red by default:  If
Nano sees one or more spaces that are immediately followed by a tab, the
whitespace is shown in red reverse video.  It is considered undesirable
because the effect of such spaces is hard to predict.  If there are too
few of them to reach the next tab stop, they will do nothing (but waste
bytes).  If there are enough, they will push following tabs over.  It's
probably never a good thing.

Is there something I can set in my ~/.emacs globally to make Emacs
never, ever save space characters to a file if there is a tab character
immediately folowing it?  I can't think of a situation, either coding or
writing in human language, where I would ever want that.

-- 
He that would make his own liberty secure must guard even his enemy from
oppression; for if he violates this duty, he establishes a precedent
that will reach to himself.
					--Thomas Paine


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

* Re: spaces before tabs (yuck!)
  2015-11-04  0:10 spaces before tabs (yuck!) Hikaru Ichijyo
@ 2015-11-04  0:24 ` Kaushal Modi
  2015-11-04  2:34 ` Drew Adams
  2015-11-04 15:54 ` Kendall Shaw
  2 siblings, 0 replies; 6+ messages in thread
From: Kaushal Modi @ 2015-11-04  0:24 UTC (permalink / raw)
  To: Hikaru Ichijyo; +Cc: Help Gnu Emacs mailing list

> Recent versions of Nano actually highlight this in red by default

In emacs, you can finetune the hightlights for space after/before
tabs. To learn more about that, evaluate (require 'whitespace) and
then C-h v whitespace-style.



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

* RE: spaces before tabs (yuck!)
  2015-11-04  0:10 spaces before tabs (yuck!) Hikaru Ichijyo
  2015-11-04  0:24 ` Kaushal Modi
@ 2015-11-04  2:34 ` Drew Adams
  2015-11-04 15:54 ` Kendall Shaw
  2 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2015-11-04  2:34 UTC (permalink / raw)
  To: Hikaru Ichijyo, help-gnu-emacs

> The question of tabs versus spaces is so notorious, it has its own
> chapter in the Emacs manual.

Likewise, Emacs Wiki: http://www.emacswiki.org/emacs/TabsAreEvil.
That page also offers some alternatives and workarounds.

> Some people hate the confusion that tabs cause them so much that
> they set indent-tabs-mode nil to make it so only
> spaces are ever used, and there are no tabs anywhere.

Yes, and there is recent renewal of discussion about making this
the default behavior.

> I don't want to do that.

OK.



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

* Re: spaces before tabs (yuck!)
  2015-11-04  0:10 spaces before tabs (yuck!) Hikaru Ichijyo
  2015-11-04  0:24 ` Kaushal Modi
  2015-11-04  2:34 ` Drew Adams
@ 2015-11-04 15:54 ` Kendall Shaw
  2015-11-04 16:14   ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: Kendall Shaw @ 2015-11-04 15:54 UTC (permalink / raw)
  To: help-gnu-emacs

On 11/03/2015 04:10 PM, Hikaru Ichijyo wrote:
> I just want to make it so Emacs will never
> insert spaces unless the next character is either a visible/printable
> one, or it is the end of the line.

It's not the topic. But, if it is not understood: As that link
some posted says "tabs are evil". Tab characters occurring in a
text file always cause a problem unless:

1. It doesn't matter how much horizontal space is going to be
represented by the tab character. For example, an unimportant
amount of space is needed at the beginning of a line that is printed
to a console.

2. No one but the person who inserted the tab character will ever
read or edit the file and they will never use a program that uses
a different amount of horizontal space to represent the character
than any other program.

3. The file will only ever be used in a specific program that
always uses the same amount of horizontal space to represent the
tab character.

4. An arbitrary rule requires the use of tab characters.

5. You are writing a make file or some other source file that has an
arbitrary rule requiring tab characters.

It is causing confusion and extra work for everyone in the future
to use a tab character in a text file. It is anti-social
behavior.

Kendall





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

* Re: spaces before tabs (yuck!)
  2015-11-04 15:54 ` Kendall Shaw
@ 2015-11-04 16:14   ` Stefan Monnier
  2015-11-04 17:21     ` Kendall Shaw
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2015-11-04 16:14 UTC (permalink / raw)
  To: help-gnu-emacs

> 2. No one but the person who inserted the tab character will ever
> read or edit the file and they will never use a program that uses
> a different amount of horizontal space to represent the character
> than any other program.
[...]
> It is causing confusion and extra work for everyone in the future
> to use a tab character in a text file. It is anti-social
> behavior.

The flip side is that using anything but a width of 8 columns to
represent TABs is causing confusion and is anti-social behavior.

In any case, if you seriously worry about TAB-vs-SPC, your social life
is probably sufficiently limited that any anti-social behavior you might
display won't affect too many people ;-)


        Stefan




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

* Re: spaces before tabs (yuck!)
  2015-11-04 16:14   ` Stefan Monnier
@ 2015-11-04 17:21     ` Kendall Shaw
  0 siblings, 0 replies; 6+ messages in thread
From: Kendall Shaw @ 2015-11-04 17:21 UTC (permalink / raw)
  To: help-gnu-emacs

On 11/04/2015 08:14 AM, Stefan Monnier wrote:
>> It is causing confusion and extra work for everyone in the future
>> to use a tab character in a text file. It is anti-social
>> behavior.
> The flip side is that using anything but a width of 8 columns to
> represent TABs is causing confusion and is anti-social behavior.

There are issues of priority independent of issues of
severity. If you only ever consider severity, some problems will
never be addressed.

Tabs are a minor priority medium severity issue. In
other words, it's not something to "worry" about, like data loss
would be. But, it does have long lasting fairly severe
implications.

For source code in particular, it is a recurring topic that
source code may need to be maintained by someone other than the
author and that time extends past the limits of one's attention
span, meaning that even the author of some lines of text can face
the same problem interpreting the lines of text as other people
after some period of time. So, people discuss social conventions
as an invitation to cooperation.

This is an instance of that recurring topic.

People's setting for tab width representation is not an analogous
flip-side to the argument.

It is like the difference between suggesting neighbors not make
loud noises at 4 in the morning vs. suggesting that neighbors
wear ear plugs so that people can be free to make loud noises at
4 in the morning.

Regarding using or not using tab characters, you can't force
people to do either, and it's not suggested usually that that
would be an option.

 From the perspective of an open source or free software community
based on cooperation, as a suggestion for how to cooperate,
people can offer a convenience to others by not using tab
characters.

When people don't take the suggestion, the situation is as it is
now. Things are made no worse.

When people do take the suggestion, the situation is made
minimally better, as not throwing garbage out one's car window
makes things minimally better.

By comparison, suggesting that everyone set tab width to 8
characters and favoring the existence of tab characters in text
files, is not analogous.

When people don't take the suggestion, confusion resulting from
tab characters continues. Things are made slightly worse because
introducing confusion is promoted.

When people do take the suggestion, confusion resulting from tab
characters continues. Things are made slightly worse because
introducing confusion is promoted.

Kendall



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

end of thread, other threads:[~2015-11-04 17:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-04  0:10 spaces before tabs (yuck!) Hikaru Ichijyo
2015-11-04  0:24 ` Kaushal Modi
2015-11-04  2:34 ` Drew Adams
2015-11-04 15:54 ` Kendall Shaw
2015-11-04 16:14   ` Stefan Monnier
2015-11-04 17:21     ` Kendall Shaw

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.