lewang / ws-butler

Unobtrusively trim extraneous white-space *ONLY* in lines edited.
248 stars 29 forks source link

Is there a way to not remove whitespace at the end of file? #26

Open computersarecool opened 8 years ago

computersarecool commented 8 years ago

I actually like the extra new line at the end of the file. Is there a way not to remove it?

lewang commented 8 years ago

Not currently. What's the usecase?

On Tue, Oct 18, 2016 at 1:48 AM, Willy Nolan notifications@github.com wrote:

I actually like the extra new line at the end of the file. Is there a way not to remove it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lewang/ws-butler/issues/26, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjzbJsWQrVMRu2xARP_zP6OQ5Kl-SGNks5q1F2-gaJpZM4KZZnP .

Le

computersarecool commented 8 years ago

I have been told it is good practice

lewang commented 8 years ago

Have you consulted the documentation for require-final-newline?

computersarecool commented 8 years ago

Yes and I currently have it set to t which means it should add a new line when the file is about to be saved. Unfortunately it looks like butler removes the newline after this.

lewang commented 8 years ago

Ok, that's a bug then. I'll take a closer look when I get a chance.

computersarecool commented 8 years ago

Thanks

computersarecool commented 7 years ago

It looks like you have code here specifically trying to avoid this but it is removing the newline on my files.

lewang commented 7 years ago

Can you give repro steps from emacs -Q? I just saved a file that had require-final-newline set to t and the final newline was added.

computersarecool commented 7 years ago

Steps to reproduce:

Start emacs -Q Install ws-butler Visit file testing.js Enable linum-mode (to see line numbers) Enable ws-butler-mode

Type const http = require('http') followed by 3 new lines On line 2 type console.log(http) Type C-x C-s

File will be truncated to two lines wc -l testing.js = 2