[Top][All Lists]

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

Re: Emacs removes whitespaces at the end of lines

From: Tassilo Horn
Subject: Re: Emacs removes whitespaces at the end of lines
Date: Mon, 03 Aug 2009 13:20:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Anselm Helbig <address@hidden> writes:


>> > 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)
>> [...]
>> (add-hook 'write-file-hooks 'untabify-before-write)

The right approach (if it's really a convention for rails code) would be
to call

   (add-hook 'write-file-hooks 'untabify-before-write nil t)

inside the `rails-mode' function.  The last parameter to `add-hook'
makes this hook buffer-local, so the untabify function would only be run
when saving a file that is in rails-mode.

> 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 think you (or F. Unglaub) should send a bug report to the rails-mode
devs.  Modes must not change global settings.

> 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))

Yes, that's a workaround.


reply via email to

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