jed-users mailing list

[2017 Date Index] [2017 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [jed-users] rm trailing whitespace on write


Hi pdg,

> Anybody have a mechanism to remove trailing whitespace
> on buffer write (or read I guess).

I'm not sure, if this is, what you're looking for, but I use the following in
my .jedrc to remove trailing whitespaces, whenever I save the buffer:

define my_trim_buffer()
{
    push_spot();
    while (up_1()) { eol_trim(); bol(); }
    pop_spot();
    push_spot();
    while (down_1()) { eol_trim(); bol(); }
    pop_spot();
}

add_to_hook("_jed_save_buffer_before_hooks",&my_trim_buffer);

Note, that it does not remove empty lines at the end of the buffer.

Cheers, Berni

-- 
-- Meine Rätselwebseite: www.croco-puzzle.com

_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.


[2017 date index] [2017 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]