[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs removes whitespaces at the end of lines
From: |
Noah Slater |
Subject: |
Re: Emacs removes whitespaces at the end of lines |
Date: |
Sun, 2 Aug 2009 18:58:00 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Sun, Aug 02, 2009 at 03:28:16PM +0200, F. Unglaub wrote:
> I use emacs with mutt and slrn (post-mode) and noticed that
> whitespaces at the end of lines are auto-removed. This leads to
> problems, for example, with the signature delimiter "-- \n". In my
> case it's reduced to "--\n" which certain newsreaders like tin
> consider wrong.
I was getting this too, and I came up with:
(defun cleanup-buffer ()
(unless (or (equal major-mode 'makefile-mode)
(equal major-mode 'makefile-automake-mode)
(equal major-mode 'makefile-gmake-mode))
(untabify (point-min) (point-max)))
(delete-trailing-whitespace)
(when (equal major-mode 'post-mode)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "^--$" nil t) (replace-match "-- " nil nil)))))
(add-hook 'write-file-hooks 'cleanup-buffer)
That should add the space back in as you save the file.
Best,
--
Noah Slater, http://tumbolia.org/nslater
- Emacs removes whitespaces at the end of lines, F. Unglaub, 2009/08/02
- Re: Emacs removes whitespaces at the end of lines, Tassilo Horn, 2009/08/02
- Re: Emacs removes whitespaces at the end of lines, David Kastrup, 2009/08/02
- Message not available
- Re: Emacs removes whitespaces at the end of lines, F. Unglaub, 2009/08/02
- Re: Emacs removes whitespaces at the end of lines, Tassilo Horn, 2009/08/02
- Message not available
- Re: Emacs removes whitespaces at the end of lines, F. Unglaub, 2009/08/03
- Re: Emacs removes whitespaces at the end of lines, Anselm Helbig, 2009/08/03
- Re: Emacs removes whitespaces at the end of lines, Tassilo Horn, 2009/08/03
- Re: Emacs removes whitespaces at the end of lines, F. Unglaub, 2009/08/03
Re: Emacs removes whitespaces at the end of lines,
Noah Slater <=