From: seberino@spawar.navy.mil (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 [thread overview]
Message-ID: <bf23f78f.0308281111.5876c953@posting.google.com> (raw)
In-Reply-To: 8765kr995j.fsf@member.fsf.org
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 <jao@member.fsf.org> wrote in message news:<8765kr995j.fsf@member.fsf.org>...
> 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
>
> seberino@spawar.navy.mil (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
next prev parent reply other threads:[~2003-08-28 19:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-20 22:52 How delete whitespace at END of file automatically when save and exit file? Christian Seberino
2003-08-20 23:55 ` Jose A. Ortega Ruiz
2003-08-21 6:39 ` Lute Kamstra
2003-08-25 23:55 ` Christian Seberino
2003-08-28 19:11 ` Christian Seberino [this message]
2003-08-29 14:51 ` Thien-Thi Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bf23f78f.0308281111.5876c953@posting.google.com \
--to=seberino@spawar.navy.mil \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).