From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nerius Landys Newsgroups: gmane.emacs.help Subject: Re: [emacs] tabs, spaces, and indentation Date: Mon, 11 Oct 2010 15:14:53 -0700 Message-ID: References: <20101009020801.GD4996@srevilak.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016361e88ba8b525704925eb053 X-Trace: dough.gmane.org 1286836488 20996 80.91.229.12 (11 Oct 2010 22:34:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 11 Oct 2010 22:34:48 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: PJ Weisberg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 12 00:34:46 2010 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.69) (envelope-from ) id 1P5QxB-00056t-Ip for geh-help-gnu-emacs@m.gmane.org; Tue, 12 Oct 2010 00:34:45 +0200 Original-Received: from localhost ([127.0.0.1]:49571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5Qt1-0008Pe-Cn for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Oct 2010 18:30:27 -0400 Original-Received: from [140.186.70.92] (port=33160 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5Qe1-0002nW-Pu for help-gnu-emacs@gnu.org; Mon, 11 Oct 2010 18:14:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P5Qdx-0007GV-Mv for help-gnu-emacs@gnu.org; Mon, 11 Oct 2010 18:14:55 -0400 Original-Received: from mail-qw0-f41.google.com ([209.85.216.41]:43117) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P5Qdx-0007GN-JY for help-gnu-emacs@gnu.org; Mon, 11 Oct 2010 18:14:53 -0400 Original-Received: by qwb8 with SMTP id 8so1876340qwb.0 for ; Mon, 11 Oct 2010 15:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=GgZ5CVwY7lDPrRPlQ7C2+UgSyKSjp/Xyz6M+NR3H0Lg=; b=TLFml3JWm1xQfZwQCETKdsNIny+vc8GgQGBCOM1X1UW9N5Te6TwdZJmahdn7d/HuM3 q+Vlk/f7aEWqRnnjfgz+9Hn22NX5rZpUkqdObFEsYwfYYqXrZh2s2IHIrtjFj9cqh8ep y19xHMyJG1iSf7AENrzQISECxZcAsBGRAawDI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=sLEZAeUlxeWwngAE4sEen0cPRu9Y+0+55o+C2U0+L56Tuf+Qsgmu5FrggLg77+BOMO d58rZ4C8u/ZCv6oyoJZzxGdubP5jdThH9/NH4TO/wtKZYzu+viCFDnHibvYGg27Zfak3 x5cojLamSsbKzR1nELCpuEl/BD9ymKNGFBZSk= Original-Received: by 10.229.225.211 with SMTP id it19mr5518672qcb.87.1286835293343; Mon, 11 Oct 2010 15:14:53 -0700 (PDT) Original-Received: by 10.229.1.143 with HTTP; Mon, 11 Oct 2010 15:14:53 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:75107 Archived-At: --0016361e88ba8b525704925eb053 Content-Type: text/plain; charset=ISO-8859-1 > > > However, there is still one thing needed to make it behave just > > like Notepad. Let's say my cursor is positioned immediately following a > tab > > character. When I hit Backspace (I believe that causes a function > > "backward-delete-char" to be called), it converts that tab character into > a > > bunch of spaces, then deletes the last space. I would really like > Backspace > > to just delete the tab character. Is there any way to do this? I > suppose > > I'd have to rebind Backspace to a function other than > backward-delete-char, > > but I'm not sure which function. > > Is it bound to backward-delete-char? Or is it bound to > backward-delete-char-untabify? I believe the former does what you > want. > Woohoo! My final .emacs file does just what I want. (defun my-c-mode-common-hook () (c-toggle-electric-state -1) (setq tab-width 8 c-basic-offset 8 indent-tabs-mode t backward-delete-char-untabify-method nil) (define-key c-mode-base-map (kbd "TAB") 'self-insert-command)) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) --0016361e88ba8b525704925eb053 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

> However, there is still one thing needed to make it behave just
> like Notepad.=A0 Let's say my cursor is positioned immediately fol= lowing a tab
> character.=A0 When I hit Backspace (I believe that causes a function > "backward-delete-char" to be called), it converts that tab c= haracter into a
> bunch of spaces, then deletes the last space.=A0 I would really like B= ackspace
> to just delete the tab character.=A0 Is there any way to do this?=A0 I= suppose
> I'd have to rebind Backspace to a function other than backward-del= ete-char,
> but I'm not sure which function.

Is it bound to backward-delete-char? =A0Or is it bound to
backward-delete-char-untabify? =A0I believe the former does what you
want.

Woohoo!=A0 My final .emacs file does just what I wan= t.

(defun my-c-mode-common-hook ()
=A0 (c-toggle-electric-state -= 1)
=A0 (setq tab-width 8
=A0=A0=A0=A0=A0=A0=A0 c-basic-offset 8
= =A0=A0=A0=A0=A0=A0=A0 indent-tabs-mode t
=A0=A0=A0=A0=A0=A0=A0 backward-delete-char-untabify-method nil)
=A0 (def= ine-key c-mode-base-map (kbd "TAB") 'self-insert-command))(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
--0016361e88ba8b525704925eb053--