From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jonas Steverud Newsgroups: gmane.emacs.help Subject: Re: Changing the behaviour of Date: Sat, 14 Sep 2002 10:59:29 +0200 Organization: Church of Emacs, Missionary Dep. Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1031994457 3479 127.0.0.1 (14 Sep 2002 09:07:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 14 Sep 2002 09:07:37 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17q8tr-0000tz-00 for ; Sat, 14 Sep 2002 11:07:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17q8u1-0004Jm-00; Sat, 14 Sep 2002 05:07:45 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.sunet.se!news01.sunet.se!news.chalmers.se!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 66 Original-NNTP-Posting-Host: licia.dtek.chalmers.se Original-X-Trace: nyheter.chalmers.se 1031993969 6582 129.16.30.88 (14 Sep 2002 08:59:29 GMT) Original-X-Complaints-To: abuse@chalmers.se Original-NNTP-Posting-Date: 14 Sep 2002 08:59:29 GMT Mail-Copies-To: never User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.1 (sparc-sun-solaris2.8) Cancel-Lock: sha1:ivXeyW0YFlsWF3aOOVqAsEiM0Jg= Original-Xref: nntp.stanford.edu gnu.emacs.help:104907 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:1462 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:1462 "Kristoffer" writes: > How do one change the behaviour of the key, from > doing nothing but remove indentation to > actually indent properly ? What is happending is that the tab key is bound to a function which interprets the contents of the buffer and indents to a certain level - all depending according to some rules. To take Lisp as an example (I don't know Python so I can't make a Python example): (foo (bar (foobar) ) ) And now press tab on each line in a buffer where emacs-lisp-mode is active, say *scratch* (where lisp-interaction-mode is active but that's just a detail in this context), and the result is: (foo (bar (foobar) ) ) If I understand you correctly, what you want is (foo (bar (foobar) ) ) There are two ways of solving this. One is to understand the benefits of letting Emacs interpret the contents of the buffer and maybe tweak the rules I mentioned above (how to do that depends on the mode and I have no idea how to do it, never done it - but ask here and people will help you). This is what I would recommend. Just press tab and the line is indendet to either the left or the right depedning on context. Other nice things to use is to bind the enter key/return key to newline-and-indent (so you don't have to press tab youself) and the indent-region function (mark a region and do M-x indent-region to see what it does). The other way of doing this is to bind tab to tab-to-tab-stop (which is the function M-i is bound to, this is not the same thing as C-q tab since the latter inserts the tab character). Place this in you .emacs: (global-set-key (kbd "TAB") 'tab-to-tab-stop) To find out about which function a key is bound to, use C-h c and then press the key. Or press C-h k and then the key to get a description of the function. Press C-h C-h to get a list of the help functions. HTH! -- ( www.dtek.chalmers.se/~d4jonas/ ! Wei Wu Wei ) ( Meaning of U2 Lyrics, Roleplaying ! To Do Without Do )