[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Clear trailing whitespace on save, but not at the cursor
From: |
Aaron Meurer |
Subject: |
Clear trailing whitespace on save, but not at the cursor |
Date: |
Sun, 4 Mar 2012 17:48:21 -0700 |
Hi.
I have the following line in my .emacs
(add-hook 'before-save-hook 'delete-trailing-whitespace)
This clears trailing whitespace on save. I like this behavior, except
that it's a little disorienting if I happen to save in the middle of
typing something. Is there a way to clear whitespace on save, but
then "put it back" where the cursor is? I imagine I could write a
custom hook to do this, but I'm wondering if it's possible to do it in
such a way that if I save and then quit, it doesn't bug me about
saving because it modified the file again with the new whitespace. I
don't want to ever save the trailing whitespace to the file itself,
even at the cursor.
Let me know if any of that doesn't make sense, and I will try to
explain it better.
Aaron Meurer
- Clear trailing whitespace on save, but not at the cursor,
Aaron Meurer <=
- Re: Clear trailing whitespace on save, but not at the cursor, Thien-Thi Nguyen, 2012/03/05
- Re: Clear trailing whitespace on save, but not at the cursor, Juanma Barranquero, 2012/03/05
- Re: Clear trailing whitespace on save, but not at the cursor, Thien-Thi Nguyen, 2012/03/06
- Re: Clear trailing whitespace on save, but not at the cursor, Aaron Meurer, 2012/03/21
- Re: Clear trailing whitespace on save, but not at the cursor, Le Wang, 2012/03/22
- Re: Clear trailing whitespace on save, but not at the cursor, Aaron Meurer, 2012/03/22
Re: Clear trailing whitespace on save, but not at the cursor, Deniz Dogan, 2012/03/05