all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noah Slater <nslater@gnu.org>
To: "F. Unglaub" <f.unglaub@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Emacs removes whitespaces at the end of lines
Date: Sun, 2 Aug 2009 18:58:00 +0100	[thread overview]
Message-ID: <20090802175800.GA5103@tumbolia.org> (raw)
In-Reply-To: <h5449g$g9d$00$1@news.t-online.com>

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




      parent reply	other threads:[~2009-08-02 17:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-02 13:28 Emacs removes whitespaces at the end of lines F. Unglaub
2009-08-02 16:22 ` David Kastrup
2009-08-02 16:37 ` Tassilo Horn
     [not found] ` <mailman.3703.1249231048.2239.help-gnu-emacs@gnu.org>
2009-08-02 16:47   ` F. Unglaub
2009-08-02 18:41     ` Tassilo Horn
     [not found]     ` <mailman.3707.1249238538.2239.help-gnu-emacs@gnu.org>
2009-08-03  8:47       ` F. Unglaub
2009-08-03 10:22         ` Anselm Helbig
2009-08-03 10:54           ` F. Unglaub
2009-08-03 11:20           ` Tassilo Horn
2009-08-02 17:58 ` Noah Slater [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090802175800.GA5103@tumbolia.org \
    --to=nslater@gnu.org \
    --cc=f.unglaub@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.