yoya / js2-mode

Automatically exported from code.google.com/p/js2-mode
0 stars 0 forks source link

Simply opening a file in js2-mode will "fix" whitespace #41

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Mozilla is a large codebase in JS... it has lots of files with trailing
spaces (for example). Simply *opening* those files in JS2-mode causes the
trailing whitespace to be removed.

I expect that opening a file will not alter that file at all. The only time
trailing whitespace should be stripped is when I edit a particular line.

Using js2-20080413.el with GNU emacs 22.1.1 on FC8.

Original issue reported on code.google.com by bsmedb...@gmail.com on 16 Apr 2008 at 4:20

GoogleCodeExporter commented 8 years ago
I'm not seeing this behavior.  It only deletes whitespace when you save the 
buffer.

Try running emacs with the -q option (to prevent loading your startup files).  
Then
load js2-mode and see if you see the behavior.  I suspect you've got some sort 
of
hook causing the buffer to be marked dirty and/or auto-saved.  Or something.

Original comment by steve.ye...@gmail.com on 19 Apr 2008 at 8:59

GoogleCodeExporter commented 8 years ago
Hrm, perhaps I did... I cannot reproduce the "immediately dirty buffer" I 
thought I
saw earlier... may I morph this to an enhancement, then?

The Mozilla policy is not to go "cleaning up" files when you patch them; you 
should
avoid trailing whitespace in new or patched code. Therefore, what I'd like the 
code
to do is strip trailing whitespace from lines that I edit, but don't touch 
lines that
I haven't edited.

Original comment by bsmedb...@gmail.com on 21 Apr 2008 at 1:28

GoogleCodeExporter commented 8 years ago
I've changed it in later releases NOT to do this by default, so this issue is 
now fixed.

Original comment by steve.ye...@gmail.com on 16 Jun 2008 at 4:21