On Mon, Apr 13, 2015 at 1:06 PM, John Clements
<
clem...@brinckerhoff.org> wrote:
>
> On Apr 13, 2015, at 2:29 AM, Jon Zeppieri <
zepp...@gmail.com> wrote:
>
>>
>> It's supposed to have the same effect as emacs's `delete-trailing-whitespace`.
>> I still need to add a preference setting to turn it on or off. (Maybe
>> that should be based on the editor's mode?)
>
> I’d really like to use this tool.
>
> Here’s one problem that I see: there’s a hidden invariant in DrRacket (and all editors) that when a buffer is unchanged, saving it won’t change the file on disk. Actually, I think you can state this in a bunch of different ways. I forsee hard-to-understand errors arising from a silent change-on-save (unless I’m misreading your code?). Personally, I think I’d be more likely to use a tool that requests permission to scrub trailing whitespace when saving a file. I also think that this should probably be limited to racket and scribble files, and I’m guessing that the easiest way to distinguish these would be to use the filename extension.
>
> Please don’t let me stop you from doing this, though, this is something I’ve wanted for quite a while!
>
> Many thanks,
>
> John
Good point. `delete-trailing-whitespace` is just a normal function in
emacs, and if you want this to happen when saving a file, you use a
before-save-hook. (This is a pretty common thing to do, though.)
Exposing this as a method on text% is simple, I think. Then you could
bind a keyboard shortcut to it or bring up a model on save (though
personally I would find the latter pretty irritating). But, yes,
different modes of use are important, I think. So I need to add a way
of setting preferences for it.
-Jon