Uncredible, I have read the post about the bad codes of flickr, yahou., reddit etc. And now that one. You whould work for me
Myabe its just the example you gave, but its no big deal really, get a life.
If itâs my file, I press Ctrl+K+D sometimes, and that usually gets rid of them + the other formatting annoyances. If I modify somebody otherâs file, I can mess up the svn patch by doing that, so sometimes when I notice the whitespaces in the patch file, I go back to the file and delete them. Anyway itâs annoying.
At least in corporate âenterprise applicationâ code,
the problem with trailing whitespace is that it often
indicates cruddy, cut-n-paste coding by cut-rate,
one-size-fits-all, lowest-bid consultants.
This whole discussion is ridiculous enough, when itâs a tool problem that can be solved with proper editors. But, then, blaming consultants? I know of many lamo-waiting-for-retirement-even-tho-they-are-only-in-their-30s-programmers that write the worst code on the planet.
Letâs be nice. Letâs get good tools.
My old programming teacher always wrote the most incomplete and syntax violating examples in class - his excuse? âI let the parser find my typing errorsâ
very good blog, I come here every day,thanks very much for post.
Seriously - 8000 comments and only one person mentioned that this was a) horrible markup and b)just plain old bad code. Never ever mix markup and c# code. That should be an asp repeater bound to a data source. Who cares about the whitespaceâŚ
Hereâs how I keep my whitespace under control in emacs:
(setq-default indent-tabs-mode nil
require-final-newline t)
(setq whitespace-check-indent-whitespace nil)
(require 'whitespace)
(global-whitespace-mode t)
(add-hook 'before-save-hook
âwhitespace-cleanup)
I m sure sure I use other editors for python, one showing me every tab, I tend to do the same for YAML files.
I use Visual Studio 2005 and every now and then I use this procedure to bulk-remove trailing white space from the code:
- Press âCTRL + SHIFT + Hâ to open âReplace in Filesâ dialog
- Find what = â:b+$â (colon, small b, plus, dollar)
- Replace with = ââ (empty string)
- Use = âRegular expressionsâ
- Look in = ââ
- Look at these file types = â.asp;.css;*.jsâ
Works nicely. But until you get used to this procedure, remember to backup your files.
Myabe its just the example you gave, but its no big deal really, get a life.
I agree
thanks admin
Are you really cool
Removing trailing whitespace on save is always a good thing. Even if thereâs no functional difference, itâs nice to be able to compare versions in your SCM without having to worry about whitespace. Now, donât even think about opening the âspace vs. tabâ can of worms!
CTRL+K, CTRL+D baby.
I tried Acme::Bleach once and it destroyed the code. Maybe it was because it was Perl 5.004 on HP-UX or something.
I also loved that the Delphi IDE automatically removed trailing whitespace.
I guess I must be more hardcore OCD than Jeff, because I often go through the code and check for trailing whitespace manually! Though I find itâs only a problem if I copy/paste.
Trailing whitespace is boring. Tabs vs spaces is the real horror!
In Python, EOL whitespace can be relevant!
if condition1 and .âŚ
condition2
Python will complain about that trailing whitespace after the
line-continuation character!
Thatâs not Python specific, and has nothing to do with the Pythonesque kind of whitespace-significance (that is indeed beginning-of-line only). Itâs just a consequence of the fact that, if you want to escape a character, you have to put that character immediately after the backslash. E.g. if youâre in a string and you want to insert a quote mark*, you might write "; [space]" wouldnât work. So if you want to escape an end of line, of course you have to have the backslash write before the end of line; otherwise youâre just escaping a random space.
So thatâs not really an instance of actual significant whitespace any more than the fact, if you have a variable âfooâ, you canât refer to it as âfo oâ, means that that language has 'significant whitespace.
In 1924, George Mallory, when he was asked why he wanted to climb Mount Everest, said âBecause itâs there.â I suppose most still did not understand why. Similarly, if you didnât understand the pain of this article, you probably never will.
Just be glad your boss doesnât inist on using tabs instead of spaces! le sigh
On a side note, youâd think that being an OCD freak youâd have spotted the following:
âAlso, how exactly is that day is different from any other? But seriously.â
is=any?
âI recently forced all the programmers on my team to make sure their VS options had tabs NOT SPACESâŚâ
This is evil. Could you say what team you run so I can avoid it.
I donât see what all the fuss is about.