unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: how do you strip leading white spaces in c-mode or similar?
Date: Fri, 06 Jul 2007 12:35:12 +0200	[thread overview]
Message-ID: <87odipq0pr.fsf@baldur.tsdh.de> (raw)
In-Reply-To: 1183685346.183441.17470@n60g2000hse.googlegroups.com

Johna <nnn4431@mailc.net> 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)

  reply	other threads:[~2007-07-06 10:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-05  0:34 how do you strip leading white spaces in c-mode or similar? Johna
2007-07-05  8:49 ` brianjiang
2007-07-05 13:20 ` Eli Zaretskii
2007-07-05 17:48 ` Peter Lee
2007-07-06  1:29   ` Johna
2007-07-06 10:35     ` Tassilo Horn [this message]
2007-07-06 12:32       ` Eli Zaretskii
2007-07-06 12:48         ` Nikolaj Schumacher
2007-07-06 15:52           ` Eli Zaretskii
2007-07-08  9:16             ` Nikolaj Schumacher
2007-07-06 12:41     ` Nikolaj Schumacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87odipq0pr.fsf@baldur.tsdh.de \
    --to=tassilo@member.fsf.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).