From: Jonas Steverud <d4jonas@dtek.chalmers.se>
Subject: Re: Changing the behaviour of <tab>
Date: Sat, 14 Sep 2002 10:59:29 +0200 [thread overview]
Message-ID: <wtnn0qlgd5a.fsf@licia.dtek.chalmers.se> (raw)
In-Reply-To: slrnao20n7.ah.vidvandre@vinyamar.nevrast.net
"Kristoffer" <gargravarr@singapore.com> writes:
> How do one change the behaviour of the <tab> 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 )
prev parent reply other threads:[~2002-09-14 8:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-12 21:11 Changing the behaviour of <tab> Kristoffer
2002-09-14 8:59 ` Jonas Steverud [this message]
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=wtnn0qlgd5a.fsf@licia.dtek.chalmers.se \
--to=d4jonas@dtek.chalmers.se \
/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).