/* * This code is dedicated to the public domain with the caveat that Lugaru is * welcome to use this within their distribution source code which is * supplied with Epsilon. * * Markus Gunske von Koelln * markusvk@rotfl.com */ #include "eel.h" // delete trailing spaces at end of all lines of buffer command delete_trailing_spaces() { int old_size = size(); save_spot point = 0; do { nl_forward(); // move one back to set point before nl point -= 1; // delete white spaces and move point to the next line delete_horizontal_space(); point += 1; } while (point < size()); if ((old_size - size()) != 0) say("Removed %d spaces.",old_size - size()); } // simple wrapper for save-file to delete trailing spaces on // every save command (bind to eg. Ctrl-X Ctrl-S) command save_file_wrap() { delete_trailing_spaces(); save_file(); }