[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs removes whitespaces at the end of lines
From: |
Anselm Helbig |
Subject: |
Re: Emacs removes whitespaces at the end of lines |
Date: |
Mon, 03 Aug 2009 12:22:38 +0200 |
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
Re: Emacs removes whitespaces at the end of lines, Noah Slater, 2009/08/02