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 10:47:50 +0200 Organization: T-Online Message-ID: References: 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 1249292495 12508 80.91.229.12 (3 Aug 2009 09:41:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Aug 2009 09:41:35 +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 11:41:28 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 1MXu2o-0002Oj-99 for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Aug 2009 11:41:26 +0200 Original-Received: from localhost ([127.0.0.1]:45156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXu2n-0006WG-KM for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Aug 2009 05:41:25 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!goblin1!goblin.stu.neva.ru!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!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: 48 Original-X-Trace: news.t-online.com 1249289270 00 n25737 PjFIQbKr7NAOuiu 090803 08:47:50 Original-X-Complaints-To: usenet-abuse@t-online.de X-ID: SIdM6aZfZeqhT4WKhcHiMHNZGf+mUosAnR4W6ML80H+GtaW5THBdYk User-Agent: slrn/0.9.9p1 (Linux) Original-Xref: news.stanford.edu gnu.emacs.help:171517 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:66698 Archived-At: 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) Regards. -- Troubles are like babies; they only grow by nursing.