From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: Substiotution of tabs with spaces... Date: 16 Apr 2005 01:38:46 +0200 Organization: [posted via Easynet Spain] Message-ID: <87acnz8vax.fsf@thalassa.informatimago.com> References: <87is2o9o6i.fsf@thalassa.informatimago.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1113608216 3025 80.91.229.2 (15 Apr 2005 23:36:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 15 Apr 2005 23:36:56 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 16 01:36:52 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DMaMg-0008Mo-GQ for geh-help-gnu-emacs@m.gmane.org; Sat, 16 Apr 2005 01:36:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DMaQG-0003d4-UP for geh-help-gnu-emacs@m.gmane.org; Fri, 15 Apr 2005 19:40:28 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!proxad.net!proxad.net!easynet-quince!easynet.net!easynet-post2!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Lines: 49 Original-NNTP-Posting-Host: 62.93.174.79 Original-X-Trace: DXC=9ZHjeB63ld\^XA=AS8RC;SEY<>`XO4V7]>Uh 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:25741 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:25741 Peter Dyballa writes: > Am 15.04.2005 um 15:15 schrieb Pascal Bourguignon: > > > Also, with my emacs configuration, > > M-x replace-string RET TAB > > tries to substitute a string of four spaces, not one tabulation. > > > > Try: > > > > M-x replace-regexp RET C-q TAB + RET SPC SPC SPC RET > > M-x replace-string RET C-q TAB RET SPC SPC SPC RET > > > > Yes, that's something I've seen here too. I remember that I failed a > few times to remove, i.e. replace-regexp with nothing, [SPC TAB]+$ > -- there could be a better regexp too. Do have an idea why TAB is > sometimes \t and sometimes a few spaces? TAB is TAB, and SPC is SPC. What happens, is that TAB is a CONTROL character that was used to CONTROL a mecanical teletype device, to make it move mecanically the carriage to the next tabulation stop. Since its meaning depends highly on the device (the width of the tabulation changes, on some devices there's no tabulation, so it doesn't show at all or is replaced by one space), and you cannot SEE whether there is one TAB or several SPC, it should not be used in normal files. Use instead only SPC and sequences of SPC. That's why in emacs, we usually bind the TAB key to more interesting functions, such as lisp-indent-line or c-ident-command, and these command indent the current line according to the syntax (using normaly only spaces). This has the added benefit that when you visualise the file in a different environment, it always display correctly indented. You should have: (setq tab-always-indent t) in your ~/.emacs ! -- __Pascal Bourguignon__ http://www.informatimago.com/ Nobody can fix the economy. Nobody can be trusted with their finger on the button. Nobody's perfect. VOTE FOR NOBODY.