From: Anselm Helbig <anselm.helbig+news2009@googlemail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs removes whitespaces at the end of lines
Date: Mon, 03 Aug 2009 12:22:38 +0200 [thread overview]
Message-ID: <87d47d8adt.wl%anselm.helbig+news2009@googlemail.com> (raw)
In-Reply-To: <h5687l$p49$00$1@news.t-online.com>
Hi!
At Mon, 3 Aug 2009 10:47:50 +0200,
"F. Unglaub" <f.unglaub@gmail.com> wrote:
>
> On 2009-08-02, Tassilo Horn <tassilo@member.fsf.org> wrote:
> > "F. Unglaub" <f.unglaub@gmail.com> writes:
> >
> > Hi!
> >
> >>> Back to the problem: Normally, emacs should not do that, so I guess
> >>> that's something you (or your sysadmin) configured. Something like:
> >>>
> >>> (add-hook 'before-save-hook 'delete-trailing-whitespace)
> >>>
> >>> So grep your ~/.emacs and the files in the site-lisp directory for
> >>> `delete-trailing-whitespace'.
> >>
> >> I can only find delete-trailing-whitespace in my rails-mode.el
> >> file. And I'm certain that I'm not using rails-mode for posting emails
> >> and news.
> >
> > Well, it could be that rails-mode adds that to some hook globally. In
> > the worst case, then simply loading the mode would cause that behavior.
>
> Looks like this is the case here. I removed rails-mode from my .emacs
> and that seems to solve the problem for me.
>
> > Please poste the relevant lines of rails-mode, then we'll see if they
> > are the culprit.
>
> Here are the relevant lines: (untabify-file.el)
>
> (defun untabify-before-write ()
> "Strip all trailing whitespaces and untabify buffer before
> save."
> (when (and (eq this-command 'save-buffer)
> (not (find nil
> untabify-exclude-list
> :if #'(lambda (r)
> (typecase r
> (string (string-match r (buffer-name)))
> (symbol (eq major-mode r)))))))
> (save-excursion
> (untabify (point-min) (point-max))
> (delete-trailing-whitespace))))
>
> (add-hook 'write-file-hooks 'untabify-before-write)
Yes, unfortunately emacs-rails behaves more like rails and not like a
well-behaved, humble emacs extension should: it just turns on a lot of
behavior, assuming that you'll probably like it. I'd rather turn stuff
on that I like than have to turn stuff off that comes into my way...
If you want to keep emacs-rails and don't want to remove the line
containing the call to `add-hook', you can just remove the hook after
untabify-file is loaded:
(eval-after-load "untabify-file"
'(remove-hook 'write-file-hooks 'untabify-before-write))
HTH,
Anselm
--
Anselm Helbig
mailto:anselm.helbig+news2009@googlemail.com
next prev parent reply other threads:[~2009-08-03 10:22 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 [this message]
2009-08-03 10:54 ` F. Unglaub
2009-08-03 11:20 ` Tassilo Horn
2009-08-02 17:58 ` Noah Slater
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=87d47d8adt.wl%anselm.helbig+news2009@googlemail.com \
--to=anselm.helbig+news2009@googlemail.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.
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).