From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Johna Newsgroups: gmane.emacs.help Subject: Re: how do you strip leading white spaces in c-mode or similar? Date: Thu, 05 Jul 2007 18:29:06 -0700 Organization: http://groups.google.com Message-ID: <1183685346.183441.17470@n60g2000hse.googlegroups.com> References: <1183595671.444536.287460@r34g2000hsd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1183686034 20831 80.91.229.12 (6 Jul 2007 01:40:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 6 Jul 2007 01:40:34 +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 03:40:33 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 1I6coA-0005Tv-Cw for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Jul 2007 03:40:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I6co9-000318-P5 for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Jul 2007 21:40:29 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!n60g2000hse.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 24 Original-NNTP-Posting-Host: 209.6.126.113 Original-X-Trace: posting.google.com 1183685346 32133 127.0.0.1 (6 Jul 2007 01:29:06 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 6 Jul 2007 01:29:06 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20061201 Firefox/2.0.0.4 (Ubuntu-feisty),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: n60g2000hse.googlegroups.com; posting-host=209.6.126.113; posting-account=OoXo5Q0AAADYRjNnqsJ9LnKrYbt_HEYk Original-Xref: shelby.stanford.edu gnu.emacs.help:149906 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:45495 Archived-At: On Jul 5, 1:48 pm, Peter Lee wrote: > >>>> Johna writes: > > > Basically I am frustrated with the default indentation in c-mode (or > > similar modes) because it inserts unnecessary white space(s) on empty > > lines. I want all empty lines to contain nothing but '\n'. Instead they > > contain "\n\t" or "\n ". > > If you are only concerned about the extraneous spaces being persisted you could: > > 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? I added the above line to the end of my .emacs file, restarted emacs but it had no effect. The white space usually is added when I press TAB and then ENTER for those who wonder where it comes from.