help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clear trailing whitespace on save, but not at the cursor


From: Thien-Thi Nguyen
Subject: Re: Clear trailing whitespace on save, but not at the cursor
Date: Tue, 06 Mar 2012 09:23:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

() Juanma Barranquero <address@hidden>
() Mon, 5 Mar 2012 16:07:51 +0100

   That does not answer to this part of the request:

   > 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.

If you add ‘delete-trailing-whitespace’ to ‘before-save-hook’,
then the re-adding of the string is also saved and the buffer
is left with (buffer-modified-p) => nil.

There is, anyway, a bug: The condition:

  (looking-back "\\s-+" (line-beginning-position) t)

should be expanded to something like:

  (and (looking-at "\\s-*$")
       (looking-back "\\s-+" (line-beginning-position) t))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]