From: Eric Firing <efiring@ha...> - 2007-11-28 17:46:29
John Hunter wrote:
> On Nov 21, 2007 1:52 PM, Andrew Straw <strawman@...> wrote:
>> Thanks, that works, but unforunately only on emacs21 but not xemacs 21.
>> Looks like I'll now have to find a way to do the one thing in emacs that
>> keeps me using xemacs: goto-line bound to M-g. (Any quick tips appreciated.)
> I think I may have found the ultimate emacs solution. It really
> annoys me to see the trailing whitespace in my buffer. When I start a
> new indented line but end up not adding anything there, it highlights
> the region from the left of the to where the cursor was a trailing
> whitespace so I have a lot of ugly red blocks in my buffer. My new
> solution is not to highlight it, but to add a hook to emacs to delete
> it whenever I save my buffer.
> (add-hook 'python-mode-hook
> (lambda ()
> (add-hook 'local-write-file-hooks 'delete-trailing-whitespace)
> Now I can be blissfully unaware of trailing whitespace as before, and
> my editor will clean it out on save.
Excellent! I always thought that something like this should be the
solution--and should be a standard part of python mode (and of other
language-specific modes)--but not being an emacs user, I did not know
how to do it.
I assume there is also some sort of C and/or C++ mode, and similar hook
additions are needed for them--correct? Or is there a hierarchy of
modes, in which case a single hook could go at a higher level?
Get latest updates about Open Source Projects, Conferences and News.