My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 83: indent-for-tab-command broken
2 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by ribrdb, Jun 19, 2008
What steps will reproduce the problem?
1. Move the point to the whitespace at the beginning of a line
2. Press TAB

What is the expected output? What do you see instead?
Point should move to first non-whitespace character. Instead it doesn't move.
The documentation for indent-for-tab-command says:
If initial point was within line's indentation, position after
the indentation.  Else stay at same point in text.



What version of the product are you using? On what operating system?


Please provide any additional information below.

 
Comment 1 by dmhouse, Jul 18, 2008
In other words, if we're in the indentation, and we press TAB, we should jump to the
end of the indentation before we begin bounce-indenting to agree with
indent-for-tab-command's docstring. Here's a patch to do that.
83.diff
2.4 KB   Download
Comment 2 by dmhouse, Jul 25, 2008
Incidentally, modes derived from cc-mode also behave in this way. E.g. (! represents
point):

M-x c-mode

int foo();
!    bar();
}

TAB

int foo();
  !bar();
}

However, TAB runs c-indent-command, rather than indent-for-tab-command, so they're
not violating any documentation.
Comment 3 by dmhouse, Jul 31, 2008
Also worth noting: haskell-mode, which also does bounce-indenting (and has TAB bound
to indent-for-tab-command), behaves as follows: 

1. If the current line is indented to one of the valid indent stops for this line,
and the point is in the indentation, call (back-to-indentation).

2. If the current line is indented to one of the valid indent stops for this line,
but the point isn't in the indentation, bounce indent.

3. If the current line is not indented to one of the valid indent stops for this
line, (back-to-indentation) and bounce indent.

So this policy is another option.

0 bytes   Download
Comment 4 by dmhouse, Jul 31, 2008
Oh, typo in my comment #2: I of course meant: 

int foo() {
!    bar();
}

TAB

int foo() {
  !bar();
}

(I have c-basic-offset set to 2, by the way.)
Sign in to add a comment

Hosted by Google Code