From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Slater Newsgroups: gmane.emacs.help Subject: Re: Emacs removes whitespaces at the end of lines Date: Sun, 2 Aug 2009 18:58:00 +0100 Message-ID: <20090802175800.GA5103@tumbolia.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1249247797 14042 80.91.229.12 (2 Aug 2009 21:16:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Aug 2009 21:16:37 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "F. Unglaub" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Aug 02 23:16:30 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MXiPq-0000jp-RD for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Aug 2009 23:16:27 +0200 Original-Received: from localhost ([127.0.0.1]:52133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXiPq-00046k-3c for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Aug 2009 17:16:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MXfJx-0008DW-EY for help-gnu-emacs@gnu.org; Sun, 02 Aug 2009 13:58:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MXfJs-0008Bq-MK for help-gnu-emacs@gnu.org; Sun, 02 Aug 2009 13:58:09 -0400 Original-Received: from [199.232.76.173] (port=48173 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXfJs-0008Bk-EB for help-gnu-emacs@gnu.org; Sun, 02 Aug 2009 13:58:04 -0400 Original-Received: from tumbolia.org ([80.68.94.123]:33884) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MXfJr-0001l6-Qp for help-gnu-emacs@gnu.org; Sun, 02 Aug 2009 13:58:04 -0400 Original-Received: from nslater by tumbolia.org with local (Exim 4.69) (envelope-from ) id 1MXfJo-0001Yx-2z; Sun, 02 Aug 2009 18:58:00 +0100 Mail-Followup-To: "F. Unglaub" , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: X-Noah: Awesome User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Sun, 02 Aug 2009 17:13:59 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66679 Archived-At: 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