From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anselm Helbig Newsgroups: gmane.emacs.help Subject: Re: Emacs removes whitespaces at the end of lines Date: Mon, 03 Aug 2009 12:22:38 +0200 Organization: Freie Universitaet Berlin Message-ID: <87d47d8adt.wl%anselm.helbig+news2009@googlemail.com> References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1249296064 22581 80.91.229.12 (3 Aug 2009 10:41:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Aug 2009 10:41:04 +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 12:40:57 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 1MXuyH-0007DG-IA for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Aug 2009 12:40:49 +0200 Original-Received: from localhost ([127.0.0.1]:36844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXuyG-0006Hs-Ta for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Aug 2009 06:40:48 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 69 Original-X-Trace: news.uni-berlin.de NU9z9xVEUHxOy1eUPxKAog65uQ355j+zfCrIfppv1GUK8XLSSulY6lXtA1 Cancel-Lock: sha1:WeqhuRBfjEe1OzY52sb0xkZaZGQ= In-Reply-To: Mail-Followup-To: anselm.helbig+news2009@googlemail.com Original-Xref: news.stanford.edu gnu.emacs.help:171518 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:66699 Archived-At: Hi! At Mon, 3 Aug 2009 10:47:50 +0200, "F. Unglaub" 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)) HTH, Anselm -- Anselm Helbig mailto:anselm.helbig+news2009@googlemail.com