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

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

Re: How delete whitespace at END of file automatically when save and exi


From: Christian Seberino
Subject: Re: How delete whitespace at END of file automatically when save and exit file?
Date: 28 Aug 2003 12:11:38 -0700

Jose

Don't you have to add (delete-trailing-whitespace) to
your write-file-hook??

I made a version based on yours that is almost perfect...

   (defun cs-delete-trailing-whitespace() (interactive)
      (delete-trailing-whitespace)
      (let ((original-pos (point)))
         (goto-char (point-max))
         (delete-blank-lines)
         (goto-char original-pos)))
 
and

(add-hook            'write-file-hooks        'cs-delete-trailing-whitespace)


For some reason these additions make me unable to do save-buffer!!!
I can't do M-x save-buffer anymore!!

M-x save-buffers-kill-emacs still works for some reason.

Chris


Jose A. Ortega Ruiz <address@hidden> wrote in message news:<address@hidden>...
> hi,
> 
> (defun my-delete-trailing-lines ()
>   (goto-char (point-max))
>   (delete-blank-lines))
> 
> (add-hook 'write-file-hooks 'my-delete-trailing-lines)
> 
> warning: untested :)
> 
> hth,
> jao
> 
> address@hidden (Christian Seberino) writes:
> 
> > delete-trailing-whitespace deletes whitespace at LEFT but not at
> > BOTTOM!? How do BOTTOM too?
> >
> >
> > In other words... if I have a bunch of newlines at the end, e.g.
> > \n\n\n\n\n
> >
> > ...How replace them with just one \n?
> >
> > chris


reply via email to

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