help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs removes whitespaces at the end of lines


From: F. Unglaub
Subject: Re: Emacs removes whitespaces at the end of lines
Date: Mon, 3 Aug 2009 10:47:50 +0200
User-agent: slrn/0.9.9p1 (Linux)

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)


Regards.
-- 
Troubles are like babies; they only grow by nursing.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]