From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: how do you strip leading white spaces in c-mode or similar? Date: Fri, 06 Jul 2007 12:35:12 +0200 Organization: University Koblenz-Landau Campus Koblenz Message-ID: <87odipq0pr.fsf@baldur.tsdh.de> References: <1183595671.444536.287460@r34g2000hsd.googlegroups.com> <1183685346.183441.17470@n60g2000hse.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1183722287 16675 80.91.229.12 (6 Jul 2007 11:44:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 6 Jul 2007 11:44:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 06 13:44:46 2007 connect(): Connection refused 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 1I6mEu-0006iT-Id for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Jul 2007 13:44:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I6mEt-0005x8-KL for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Jul 2007 07:44:43 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!multikabel.net!feed20.multikabel.net!news.germany.com!news.belwue.de!news.uni-kl.de!cache.uni-koblenz.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Original-NNTP-Posting-Host: dslb-084-063-024-131.pools.arcor-ip.net Original-X-Trace: cache.uni-koblenz.de 1183718112 27160 84.63.24.131 (6 Jul 2007 10:35:12 GMT) Original-X-Complaints-To: news@cache.uni-koblenz.de Original-NNTP-Posting-Date: Fri, 6 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ref: shelby.stanford.edu gnu.emacs.help:149913 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:45502 Archived-At: Johna writes: Hi Johna, >> insert >> >> (add-hook 'before-save-hook 'delete-trailing-whitespace t t) >> >> into your mode-hook... which will strip them on each save. > > Sorry I am too dumb to do that. > Can you post a more complete example? That is complete. > I added the above line to the end of my .emacs file, restarted emacs > but it had no effect. That's all what is needed. As soon as you save the file, all trailing whitespaces will be deleted. > The white space usually is added when I press TAB and then ENTER > for those who wonder where it comes from. That's strange, anyway. Here, my emacs (22.1) removes trailing whitespaces in the current line as soon as I go to the next line... Bye, Tassilo -- The desire to be rewarded for one's creativity does not justify depriving the world in general of all or part of that creativity. (Richard M. Stallman)