Emacs auto-modes and tabs
Jason Stephenson
jason at sigio.com
Thu Apr 17 10:30:30 EDT 2003
Kevin D. Clark wrote:
> Jason Stephenson <jason at sigio.com> writes:
>
>
>>If you're feeling particularly bold, you could hack the elisp source
>>files for the modes on your system so that everything goes to tabs
>>instead of spaces. They seem to be under /usr/share/emacs on my RH
>>8.0 system.
>
>
> You're a smart guy; I'm sure you can see why this would be a pretty
> horrible thing to do.
Yeeup. Notice that I said, "[i]f you're feeling particularly bold." That
should be interpreted as "if you don't mind breaking stuff."
>>>(not to start a flamewar or anything, but you do know that inserting
>>>real tabs in certain files (i.e. source code files) is frowned upon
>>>(by some people) right?)
>>
>>Please, let's not get that started. I like spaces, other folks like
>>tabs. That's why I use Emacs. Switching from one to the other is a
>>keystroke away.
>
>
> Yes, but "switching from one to the other" involves modifying code,
> and this has bad ramifications if you're working in an environment
> with source control (or even if you're just working with diffs).
Yes. I wasn't thinking of source control when I wrote that at 2:00 a.m.
when I should have been sleeping. It does wreak havoc by basically
diffing the whole file.
>
> Also, there's another issue, illustrated by the following scenerio:
> programmer A wants tabs in his source file, but he wants his editor to
> display these tabs as 3 spaces. Programmer A writes a bunch of code.
> Programmer B wants spaces to be in his source files, and wants tabs
> displayed as tab stops. Programmer B looks at Programmer A's source
> files and has a difficult time reading them, since Programmer A has
> intermixed spaces and tabs in his indentation (which is common
> enough).
Yeah, that is ugly and I've seen it several times. This is why each
project needs a standards document somewhere that specifies the one true
way for that project. Programmers working on that project should adhere
to that standard. Not to contradict what I said earlier, but I follow
the style of whatever code I'm working on, if it was written by someone
else or if it's a large, multi-person project. Emacs will automagically
match tabs or spaces in a file if the indentation is already consistent.
Why people get in holy wars over tabs versus spaces (and I thought the
spaces people won, anyway) is beyond me. I can understand people getting
passionate about what text editor they use, after all as a programmer
it's probably the program that you spend most of your time using, but to
argue over tabs versus spaces is kinda lame, particulary when any decent
editor can do the right thing with any given file.
To me, it's like arguing about what programming language peopel should
use. None of them is right for every single project, so you use what
seems right for the project at hand, or what your boss tells you to use.
Has anyone ever just "felt like" programming in a certain language one
day? I mean you sit down at your workstation and suddenly realize, "Hey!
I'm in the mood to write some Java." Something like that has happened to
me in the past but not lately though. Now, I'm in the mood for some
Common Lisp. I'll have to see if I can find an RPM.
More information about the gnhlug-discuss
mailing list