From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "F. Unglaub" Newsgroups: gmane.emacs.help Subject: Re: Emacs removes whitespaces at the end of lines Date: Mon, 3 Aug 2009 12:54:19 +0200 Organization: T-Online Message-ID: References: <87d47d8adt.wl%anselm.helbig+news2009@googlemail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1249299679 32715 80.91.229.12 (3 Aug 2009 11:41:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Aug 2009 11:41:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 03 13:41:12 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MXvuh-0002aQ-NN for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Aug 2009 13:41:12 +0200 Original-Received: from localhost ([127.0.0.1]:51092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXvue-00087x-6Z for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Aug 2009 07:41:08 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!aotearoa.belnet.be!news.belnet.be!newsfeed.kpn.net!pfeed09.wxs.nl!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 62 Original-X-Trace: news.t-online.com 1249296859 03 n31569 LDHIQaQJQKdMn8q 090803 10:54:19 Original-X-Complaints-To: usenet-abuse@t-online.de X-ID: ZYSFCyZlreTS84Jx21f3x5DxYi-UsljSKvHbPXB4YiraC3Dz4Csm6n User-Agent: slrn/0.9.9p1 (Linux) Original-Xref: news.stanford.edu gnu.emacs.help:171519 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66702 Archived-At: On 2009-08-03, Anselm Helbig wrote: >> On 2009-08-02, Tassilo Horn wrote: >> > "F. Unglaub" 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)) Thanks a lot, that did the trick. Regards, Florian. -- What we need is either less corruption, or more chance to participate in it.