Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 8583 - Emacs-like TAB-key handling
Summary: Emacs-like TAB-key handling
Status: RESOLVED DUPLICATE of bug 10017
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 1.0   Edit
Hardware: All Linux
: P3 enhancement with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Robert Weisz CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 32730 (view as bug list)
Depends on: 9999 33495 34996
Blocks:
  Show dependency tree
 
Reported: 2002-01-28 08:34 EST by Johan Walles CLA
Modified: 2009-01-12 09:13 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Walles CLA 2002-01-28 08:34:52 EST
In Emacs' java-mode, hitting TAB indents the line I'm currently on to 
the correct position (according to the current indentation settings).  I 
would like *very much* to see this behaviour in the Eclipse java editor.

Note that the line is indented to the correct position independently of 
the cursor's current position on the line.  So even if I am at the end 
of a line with some code on it, hitting TAB will indent the current 
line, and the cursor will still be at the end of the line.  If the line 
is already correctly indented, pressing TAB has no effect.

If the cursor is located before the first non-whitespace character on 
the line, pressing TAB will both indent the line and place the cursor 
after the (newly created) whitespace at the beginning of the line (so 
that I can press TAB at the beginning of a line and then start typing).

This is a duplicate of bug 5179.  However, as CDT and JDT use different source
code editors (!), I don't see any way of extending that bug to cover CDT also.  

Also, for me personally, this is a blocker.  Emacs' indentation engine is IMO
its greatest asset, and if changing development environment (from Emacs to
Eclipse) will mean I can't have it I will be *very* reluctant to switch.
Comment 1 adrian CLA 2002-01-28 18:32:29 EST
In the latest CDT driver (cdt-eclipse-20020116), you can customize the Tab key 
to indent the line, in a fashion very similar to what's requested here.  The fix 
will consist of defining the Tab key in the 'emacs' LPEX base profile to indent 
the line's text.

So here's the workaround:
"Windows" -> "Preferences" -> "LPEX Editor" -> expand the [+] -> "User Key 
Actions" -> enter a new key definition:
  Key    tab
  Action indentTab
press "Set", then press "OK", and the Tab key will now indent the line's text.
Comment 2 Johan Walles CLA 2002-01-29 05:10:43 EST
I'll have a go at that as soon as the 2.0 build hits the streets.
Comment 3 adrian CLA 2002-02-03 16:58:29 EST
The latest LPEX drivers (both Eclipse R1.0 and R2.0) - to be made available with 
the next CDT refresh(es)) - define the Tab key in the 'emacs' base profile as 
indentText (Alt+I stays as tab character).  Its functionality is pretty close to 
the one requested here - if more is needed in order to match a real emacs 
editor, please indicate.

Also, please note that in LPEX you can define your own actions (see API 
documentation, e.g., com.ibm.lpex.samples.TestAction) and bind them to your 
favorite key (via the Preferences pages, as indicated in a previous comment in 
here).

If all is well, please resolve this bug as FIXED.
Comment 4 Johan Walles CLA 2002-02-19 08:13:40 EST
Apart from that I am unable to change the default indentation settings to
something sane I think this does the trick.  Since that is a separate problem
I'm marking this bug FIXED.
Comment 5 Johan Walles CLA 2002-10-21 07:49:15 EDT
Since the CDT has now been revamped, and LPEX thrown out the window, this is
again an issue.  Re-opening.  CC:ing default CDT UI owner.
Comment 6 Genady Beryozkin CLA 2002-10-24 14:39:56 EDT
I think it is relevant to JDT as well.
Comment 7 Johan Walles CLA 2002-10-25 02:51:24 EDT
The corresponding feature request for JDT is bug 5179.
Comment 8 Michael R Head CLA 2003-04-01 16:20:21 EST
ZClipse.org has TabNavigator which has an action called JavaLineIndent which
does this. Due to bug #33495 and bug #34996, it doesn't work on linux, but OS/X
and win32 are beautifully supported.

http://sourceforge.net/projects/zclipse (get TavNavigator)
Comment 9 Michael R Head CLA 2003-04-01 16:24:37 EST
Bug 34996 is probably also a blocker.
Comment 10 Michael McKay CLA 2003-06-19 14:27:23 EDT
*** Bug 32730 has been marked as a duplicate of this bug. ***
Comment 11 Johan Walles CLA 2003-09-30 03:43:52 EDT
Just FYI, according to bug 37472, this has been fixed for the "JDT Text"
component of Eclipse for 3.0.
Comment 12 Alain Magloire CLA 2003-10-29 15:32:15 EST
The CEditor does not seem to respect the key-binding
when the Style is set to Emacs in the workbench ....
strange ...

*** This bug has been marked as a duplicate of 10017 ***
Comment 13 Johan Walles CLA 2003-10-30 10:17:23 EST
Considering the CDT now uses the same editor the JDT uses, and the TAB issue may
have been resolved (bug 37472 is closed but bug 5179 is still open) I think this
is nowadays a more general Emacs-keybindings-should-work-in-CDT issue.