all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Changing the behaviour of <tab>
@ 2002-09-12 21:11 Kristoffer
  2002-09-14  8:59 ` Jonas Steverud
  0 siblings, 1 reply; 2+ messages in thread
From: Kristoffer @ 2002-09-12 21:11 UTC (permalink / raw)


How do one change the behaviour of the <tab> key, from
doing nothing but remove indentation to
actually indent properly ?

Currently I've been using html-helper-mode and everytime
I want to indent, which is quite often, I have to press
m-i or c-q <tab>. I really dislike this behaviour as I'm
used to pressing <tab> when I want to indent.

Python mode works almost the way I like, I just cannot
indent as much as I want.

Is there a way to change this ?

As a Emacs newbie, I really don't know what to do here.


Thanks in advance.


Kristoffer

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Changing the behaviour of <tab>
  2002-09-12 21:11 Changing the behaviour of <tab> Kristoffer
@ 2002-09-14  8:59 ` Jonas Steverud
  0 siblings, 0 replies; 2+ messages in thread
From: Jonas Steverud @ 2002-09-14  8:59 UTC (permalink / raw)


"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  )

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-14  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-12 21:11 Changing the behaviour of <tab> Kristoffer
2002-09-14  8:59 ` Jonas Steverud

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.