FWIW, here is the reason for the behavior of your recently added example. (I will not "solve" the problem here, but I am posting it to demystify what you see.)
This was determined using emacs -q , which disables my settings, so emacs 23.2 uses the default behavior.
You are in text mode. You should see (Text) or similar in the mode line at the bottom of the screen, and Ch m will tell you (in the list of minor modes) "Text mode: the main mode for editing text written for people to read." Emacs decides (via the auto-mode-alist variable) to switch to text mode if you visit a file name that matches certain extensions (e.g. .txt ).
In text mode, pressing TAB with a selected region causes indent-according-to-mode called on each line of the region sequentially. A slightly confusing way to detect this starts with Ch k TAB , which tells us that TAB is bound to indent-for-tab-command , which in this case calls indent-region - this function name is not explicitly specified in the help, but may be in which checks the variable buffer-local indent-region-function , which is nil, and: "The value nil means that indent-according-to-mode is actually executed on each line."
indent-according-to-mode checks the indent-line-function variable, which has a local indent-relative buffer value.
Use Ch f indent-relative RET to see help for this function. (Read this).
Although you probably haven’t yet had time to learn how to check it (or you’d even want to!) And fully understand everything that it tells you, this is an example of how the self-documenting aspect of Emacs allows the user to understand what is happening (which then makes it possible change of things). I just used Ch k (describe-key), Ch f (describe-function) and Ch v (describe-variable) to follow the documentation. Looking at the source code for indent-for-tab-command was as easy as clicking on the file name shown as part of the help page.
I suggest doing the following to see what happens when indent-relative works on each line:
Mx set-variable x-stretch-cursor t
Mx set-variable ruler-mode-show-tab-stops t
Mx ruler-mode
Now for each line, in turn, position the cursor at the very beginning of the line and press TAB. As a result, you will get all three lines indented to the first tab-stop ("T" in the line).
Now repeat this - make sure once again that you are at the very beginning of each line before the existing indentation.
The first character of the first line (which is currently a tab) again departs from the first tab tab, since there is no previous line for it.
Further, the first character of the second line is indented according to the position of the first non-white space of the previous line. Since the first character of the second line is also a tab, the actual text of the second line then pushes one tab forward.
The third line follows an example. Its first tab character is aligned with the first non-white space of the second line character with the same relative effect as before, giving you the final state in your example.
To emphasize, pay attention to what happens if you now enter the string "abc" above existing lines, and then return to the beginning of the next line (there was the first line before) and press TAB. Now the first tab character will be indented according to "b". Provided that the variable indent-tabs-mode is true (which means that you have valid tabs), this will not have a practical effect on the position of words in the line, since the "indentation" of the tab with spaces will not have effect until as long as the number of spaces exceeds the width of the tab (but this is another whole kettle of fish!)
All of this actually means that text-mode in Emacs does not behave as you would like in this situation. Other main modes can do completely different things when you press TAB, of course.
As always with Emacs, things you don't like can be changed or circumvented with elisp. Some searches (especially in the Emacs Wiki) will often provide useful solutions to the problems you encounter.