Emacs+ is designed to provide a more Emacs-like experience in the Eclipse text editors. Included are enhancements for keyboard driven command execution and keyboard macros, Ctrl-u, keyboard text selection, Emacs style search and query/replace, a kill ring for deleted text, balanced expressions (s-expressions), keyboard driven editor window splitting, transpositions, case conversion commands and append line-comments in the Java editor. In cases where the normal Emacs binding interferes with an Eclipse binding, the Emacs binding is preferred.

The E4 (4.x.x) version of the plugin supports Kepler & following versions and is compiled with 1.6 jdk. This plug-in is provided as is under the epl-v-1-0. You can contact support at support@mulgasoft.com.

Installation: Add the update site http://www.mulgasoft.com/emacsplus/e4/update-site to the Eclipse update manager (Help > Software Updates...) and install the desired features. Select the Emacs+ Scheme as shown below to enable the Emacs+ key bindings. Read Installation Details for additional information about the items located on the update-site.

NB: Due to currently unresolved issues in Eclipse with child key binding schemes, if you have modified any key bindings, it is recommended that before installing Emacs+ you first export your key binding changes to an Eclipse preference file. Read key binding issues for more information on this or if you are encountering difficulties enabling the Emacs+ binding scheme.

Eclipse text editors are enhanced with the following new or extended features:

Commands and Command Execution - Provides the ability to execute an arbitrary Eclipse command from the keyboard. The status area is used as the minibuffer in a way similar to incremental find. Completion is available. For example, typing "Alt-X" then "show<SPACE>" will pop up the set of commands beginning with show. See the command description for more information.

Execute Extended Command (Alt-X): Reads a command name from the minibuffer (with completion and wildcards) and executes it

Search For Command (Ctrl-S, Ctrl-R): When in Execute Extended Command, entering Ctrl-S or Ctrl-R will enter i-search
mode. Characters entered will be searched for within the buffer list
and the first (or last) match is displayed in the prompt area. A
subsequent Ctrl-S or Ctrl-R will display the next (or previous) match in the list. <CR> will execute the command currently displayed in the prompt area and exit Execute Extended Command. Select Ctrl-G to exit i-search mode.

Universal-Argument (Ctrl-U) Reads a numeric argument for the following command. The universal-argument is applicable to text and most movement and text editing commands. Note that Ctrl-U may be followed by an Alt-X<command>.

Digits or minus sign following Ctrl-U make up the numeric argument

Ctrl-U following the digits or minus sign ends the argument

Ctrl-U without digits or minus sign provides 4 as the argument

Repeating Ctrl-U without digits or minus sign multiplies the argument by 4 each time

If called with Ctrl-U <num>, the new argument is applied to the repeated command.

After repeat has been invoked with Ctrl-X Z, subsequent invocations can be made with Zuntil a non-repeat command is typed. [NB: As Eclipse does not truly support programmatic dynamic rebinding, there are separate keybindings for the initial and subsequent repeat which can (and must) be changed independently. The Z binding uses the special repeating context.]

Keyboard Macros - A keyboard macro is a command defined by the Eclipse user to stand for another sequence of command and key invocations. [The current version of Emacs+ keyboard macros does not support editing kbd macros.] Once kbd macros have been saved, they can be set up for subsequent auto-loading on Eclipse restart via the Kbd Macros Preference page. For some additional information and caveats see keyboard macros in Emacs+.

Note: Certain features of Eclipse's specialized editors can impact the creation of keyboard macros. For example, the Java editor provides options for the auto-closing of parentheses, brackets, strings, etc. Along with this it adds the convenience of letting the user type the closing syntax, and rather than re-inserting the close it moves forward to the next position. Unfortunately, Eclipse doesn't expose this in a way Emacs+ can detect, so when defining a keyboard macro, users should avoid typing the closing syntax when it has already been inserted and use Ctrl-F instead.

Kbd Macro Start (Ctrl-X (): Start the definition of a Kbd Macro

If called with Ctrl-U, append keys to the last keyboard macro after re-executing it.

If called with Ctrl-U Ctrl-U, append keys to the last keyboard macro without re-executing it.

Kbd Macro End (Ctrl-X )): End the definition of a Kbd Macro

Kbd Macro End Or Call (Optional-binding <F4> - see below): If a Kbd Macro is being defined, end the definition; otherwise, execute the most recent Kbd Macro

Mark Whole Buffer (Ctrl-X H): select entire buffer, putting point at the beginning and mark at the end

Corrects Eclipse semantics of Select All

Paragraph Commands -

Forward paragraph (Alt-}): Move forward to end of paragraph

Backward paragraph (Alt-{): Move backward to start of paragraph

Mark Paragraph (Alt-H): Select forward one paragraph

Transpose Paragraphs (unbound): Interchange the current paragraph with the next one

If called with positive Ctrl-U, moves the current paragraph forwards

If called with negative Ctrl-U moves it backwards.

If called with Ctrl-U zero, exchanges the current paragraph with the one containing the mark.

Emacs Style Search and Query/Replace - Enhances Ctrl-S and Ctrl-R and adds additional search and replace commands. Each search command has a history list (implemented as a ring buffer) traversed by Alt-P and Alt-N (NB: MacOS users can use Alt-SHIFT-N and Alt-SHIFT-P) and supports these additional sub-commands on the search or query string:

Ctrl-W - Yanks the next word from the buffer onto end of the search string and search for result

Ctrl-Y - Yanks the rest of line onto the end of the search string and search for result

Alt-Y - Yanks the last killed text onto end of the search string and search for result

Ctrl-Alt-W - Delete one character from the end of the search string and search for result

Ctrl-Alt-Y - Yank one character from current position and search for result

Ctrl-Q - Quotes a control character to search for it.

Ctrl-J - Adds an end of line for matching

Ctrl-G - While searching or when search has failed cancels the input back to what has been found successfully.

Ctrl-G - When search is successful aborts and moves back to the starting point.

As each match is found, the user must type a character saying what to do with it. Supported characters are:

SPACE or y to replace one match

DEL or n to skip to next

RET or q to exit

. (period) to replace one match and exit

, (comma) to replace one match but not move point immediately

! to replace all remaining matches with no more questions

Replace commands preserve case in each match if search-string has no uppercase letters. (Preserving case means that if the string matched is all caps, or capitalized, then its replacement is uppercased or capitalized.)

Kill Ring Behavior - The kill ring expands the ability to retrieve killed text in the Eclipse text editors beyond the most recent kill/copy. The kill ring remembers recent line, region and word deletions (adjacent word deletions - forward or back - are collected into a single entry) as well as balanced expression (S-expression) deletions. By default, word deletions are not copied to the system clipboard; but balanced expression deletions are. The length of the kill ring defaults to 30 entries. These and other kill ring behaviors can be modified on the preferences page.

Yank (Ctrl-Y): Insert the last stretch of killed text

If called with Ctrl-U then restore the text from the kill ring, counting back from the most recent as 1

Yank-Pop (Alt-Y) or (ESC-Y): Replace a just-yanked stretch of killed text with a different stretch

Append Next Kill (Ctrl-Alt-W): If the following command is a kill command, append its text to the last killed text instead of starting a new entry on the kill ring

Rotate Yank Pointer (Ctrl-Alt-Y): Rotate the yank pointer in the kill ring - displays a hint in the status bar

Browse Kill Ring: Browse the kill ring in the Emacs+ console window. The background is alternately highlighted on alternate entries.

When the auto browse preference is checked, browse the kill ring on a Yank Pop when not preceded by a Yank

Supports the sub-commands:

i - insert

y - insert

<SPACE> - insert

<RET> - insert and quit (activate text editor)

n - next entry

p - previous entry

g - refresh kill ring display

q - quit (activate text editor)

U - undo last operation in the text editor

Undo/Redo - Enhance the Eclipse Undo operation to (partially) mimic the Emacs linkage of undo/redo. When performing one or more undo commands any non-edit command, other than an undo command, breaks the sequence of undo commands. Starting from that moment, the entire sequence of undo commands just performed acts as if placed onto the undo stack (i.e. they will be redone in sequence on subsequent undo commands). Thus, you can redo changes you have undone by typing `C-f' or any other command that has no important effect, and then using more undo commands. Note, however, that unlike Emacs, as soon as the document is altered other than by an undo/redo command, the redo stack is discarded (as shocking as this discard may sound, this is the normal Eclipse behavior).

Undo+(Ctrl-_,Ctrl-X U): Undo some previous change(s)

Enabled when the Emacs-Undo preference is set (default) otherwise acts just as the unmodified Eclipse undo command

Balanced Expression Behavior (S-expressions) - These commands deal with balanced expressions, also called sexps. Balanced expressions typically include symbols, numbers, and string constants, as well as any pair of matching delimiters and their contents.

If the strict balanced expression preference is set (default) then the commands will not move out of the containing expression

with a negative argument, the command moves backward and up one or more levels

Backward Up List (Ctrl-Alt-U): Move backward out of one level of bracketed expressions

with a negative argument, the command moves forward and up one or more levels

Tags-like search behavior - Adapt the Emacs notion of tags-search to Eclipse. Search for the minibuffer string in the Project, current Working Set, or Workspace. The minibuffer string is pre-populated with the current selection, or next word (if on the same line) and can be edited by the user. Add a convenience binding (Alt-,) as an analog to tags-loop-continue.

On tags-search (and find-tag if the optional features are loaded - see below) before the command is executed the current location is stored in a ring buffer. Use pop-tag-mark (Alt-*) to return this location.

Search in Project (Alt-S): Search for text in the Project

Search in Working Set (Ctrl-U Alt-S): Search for text in the Current Working Set (or Workspace, if no Working Set)

Search in Workspace (Ctrl-U Ctrl-U Alt-S): Search for text in the Workspace

Occur: Search for text in the current buffer

List Matching Lines: alias for Occur

Alt-C - Toggle the case sensitivity of the tags-search

Next (Alt-,): Navigate to the next search result (Eclipse provides Ctrl-, for previous search result)

Pop Tag Mark (Alt-*): Pop back to where the last tags command (tags-seartch or find-tag) was invoked

When point is at the end of a line, and Ctrl-T is invoked without argument, it exchanges the previous two characters.

Transpose Words (Alt-T): Interchange words around point, leaving point at end of them.

Transpose Lines (Ctrl-X,Ctrl-T): Exchange current line and previous line, leaving point after both.

Transpose Balanced Expressions (Ctrl-Alt-T): Interchange balanced expressions around point, leaving point at end of them.

Transpose Paragraphs: Interchange paragraphs around point, leaving point at the end of them.

All the transposition commands support negative Ctrl-U to transpose in the opposite direction and (except for Ctrl-T) Ctrl+U 0 to transpose their elements between point and mark.

Case conversion commands -

Capitalize (Alt-C): Capitalize the selected region or the following word

Lowercase (Alt-L): Lower case the selected region or the following word

Uppercase (Alt-U): Upper case the selected region or the following word

All the case conversion commands support Alt-- (i.e. Alt-<minus>) to case convert the immediately preceding word without moving the cursor. So, for example, entering Alt-- Alt-C will capitalize the previous word.

Space handling -

Back To Indent (Alt-M): Move point to first non-whitespace character on the line

Delete Blank Lines (Ctrl-X Ctrl-O):

On blank line, delete all surrounding blank lines, leaving just one

On isolated blank line, delete that one

On non-blank line, delete any immediately following blank

Delete Horizontal Space (Alt-\): Delete all tabs and spaces from around the cursor

Just One Space (Alt-SPACE): Delete all spaces and tabs around the cursor, leaving one space

Split Line (Ctrl-Alt-O): Split current line, moving portion beyond point vertically down

Join Line, Delete Indentation (Alt-^): Join this line to previous line and fix up whitespace at join

Balance Windows (Ctrl+X +): Make windows same height or width in selected frame

Scroll Other Window (Ctrl-Alt-V or Alt-PageDown): Scroll the other window near full screen

Scroll Other Window Down (Alt-PageUp): Scroll the other window down near full screen

Begin Other Window (Alt-Home): Go to the beginning of the buffer in the other window

End Other Window (Alt-End): Go to the end of the buffer in the other window

Recenter Other Window (Alt-Insert): Center point in the other window
[NB: The other-window commands can cause some title/window flicker, especially if the editor area is not maximized.]

Window navigation -

Switch To Buffer (Ctrl-X B): Activate current text editor and prompt in the minibuffer for a buffer to which to switch

Replaces Eclipse version with minibuffer based implementation that provides:

Defaulting to the previous editor buffer

Buffer completion - typing Ctrl-X B<SPACE> or Ctrl-X B<TAB> will bring up the complete set of
buffers

Ctrl-X B<some characters><SPACE> or <TAB>
will bring up the buffers completions of <some characters>

Accepts wild cards (? and *) as well as simple regex strings

A ring buffer containing complete set of buffers in activation order for use with Alt-N and Alt-P.

Search For Buffer (Ctrl-S, Ctrl-R): When in Switch To Buffer, entering Ctrl-S or Ctrl-R will enter i-search mode. Characters entered will be searched for within the buffer list and the first (or last) match is displayed in the prompt area. A subsequent Ctrl-S or Ctrl-R will display the next (or previous) match in the list. <CR> will switch to the buffer currently displayed in the prompt area and exit Switch To Buffer. Select Ctrl-G to exit i-search mode.

Other Window (Ctrl-X O): Select another editor window in cyclic order

Cycle through the active window in each stackif windows have been split

Else, cycle through windows by their order in the current stack

Switch To Buffer Other Window (Ctrl-X 4 B): Select the buffer shown in the minibuffer in another window

Display Buffer Other Window (Ctrl-X 4 Ctrl-O): Display the buffer shown in the minibuffer in another window without selecting it

Open Declaration Other Window (Ctrl-X 4 .): Open declaration of the element under point in another window stack

Frame Commands -

Make Frame (Ctrl-X 5 2): Make a new frame using the current buffer

When the split editor preference is checked (default), the current editor is split and moved to a new frame

The preferences Initial/Default split frame rectangles when not 0,0,0,0 specify where to place the first/subsequent frames[NB: Eclipse always forces detached frames to be in front of the workbench window when overlapped]

Join Frame (Ctrl+X 5 0): Join current frame to the main frame

Join Other Frames (Ctrl+X 5 1): Join all frames to the main frame

Other Frame (Ctrl+X 5 O): Activate the next editor frame

Switch to Buffer Other Frame (Ctrl+X 5 B): Select buffer in another frame

Narrow to Region (Ctrl-X N N): Restrict editing of the buffer to the selected region

Widen (Ctrl-X N W): Remove the narrowing restriction from the buffer

Mark Rings - When the mark is set in a text buffer, the previous mark (if any) is pushed onto the buffer-local Mark Ring. Each buffer remembers up to sixteen previous locations of the mark. Each time a buffer is visited (or re-visited), the first mark that is set is added to the global Mark Ring (which also has a length of sixteen) as long as the entry at the top of the global Mark Ring is not from the same buffer. Several commands allow you to set marks and move between marks both locally and globally.

Exchange Point and Mark (Ctrl-X Ctrl-X): Swap point and mark and activate the selection (if necessary)

When called on a mouse (or other non-mark) selection, move point and set mark, leaving it active

Rectangle Commands - Rectangle commands operate on rectangular areas of the text, i.e. all the characters between a certain pair of columns, in a certain range of lines. A selection is typically used to denote the rectangle, but if nothing is selected, the area between point and mark is used. N.B. In the Galileo release of Eclipse, there is a block selection mode that provides useful rectangle features as well.

Kill Rectangle (Ctrl-X R K): Kill the text of the rectangle, saving its contents as the last killed rectangle

Named Registers - Named registers are places in which you can save text or locations for later use. They emulate and extend the venerable TECO's 'register' feature.Each register has a name which is a single character. Once you save text in a register, you can copy it into the buffer once or many times; a location saved in a register is used by moving point to that position. Whatever you store in a register remains there until you store something else in that register.Additionalbindings for the most common commands are available in Optional bindings.

else use selection or number after point in the buffer - defaults to 0

Increment Register (Ctrl-X R +) Store a number in register *R*

If called with Ctrl-U, use universal argument as increment, else increment by 1

View Register (Ctrl-X R V): Display what is contained in register *R*

List Registers (Ctrl-U Ctrl-X R V): Display information about all named registers in use

Line and character commands -

Forward block of lines (unbound): Move down n lines (default 6)

Backward block of lines (unbound): Move up n lines (default 6)

The value of n may be set on the preference page

Delete Trailing Whitespace (unbound): Delete all the trailing whitespace in the current buffer

Differs from the Eclipse command in that it respects narrowing created by Ctrl-X N N and friends

Goto Char (unbound): Move point to specified character position

Goto Line (Alt-G): Goto line, counting from line 1 at beginning of buffer.

Move point in the current buffer, and leave mark at the previous position.

Recenter Top Bottom (Ctrl-L): Enhance Eclipse recenter to move current line to window center, top, and bottom, successively.

With no prefix argument, the first call redraws the frame and centers point vertically within the window. Successive calls scroll the window, placing point on the top, bottom, and middle consecutively. The cycling order is middle -> top -> bottom.

If called with Ctrl-U, move current line to window-line universal argument.

Reposition Window (Ctrl-Alt-L): Make the current definition visible (if possible, depending on the editor type).

If called with Ctrl-U, move point to the beginning of the definition.

Count Lines Buffer (Ctrl-X L): Print number of lines in current buffer, and how many are before or after point

Count Lines Region (Alt-=): Print number of lines and characters in the region

Count Matches (unbound): Print and return number of matches for REGEXP following point

What Cursor Position (Ctrl-X =): Print information on cursor position

What Line (unbound): Print the current buffer line number and narrowed line number of point

Zap to Char: (Alt-Z) or (ESC Z) - Combines killing with searching: It reads a character and kills from point up to (and including) the next occurrence of that character in the buffer.

A numeric argument acts as a repeat count

A negative argument means to search backward and kill text before point.

Line Number Mode (unbound): Toggle display of line numbers in the buffer

Hl Line Mode (unbound): Toggle mode that highlights the line about the buffer's point in all buffers globally

Align Regexp (unbound): Align the current region using an ad-hoc rule read from the minibuffer.

Prompts for the regexp to align with. If no prefix arg was specified, you only need to supply the characters to be lined up and any preceding whitespace is replaced.

If a prefix arg is specified, the full regexp with parenthesized whitespace should be supplied; it will also prompt for which parenthesis group within regexp to modify, the amount of spacing to use, and whether or not to repeat the rule throughout the line.

You can remove all indentation from a region by giving a large negative ARG.

Indent For Tab (unbound): Indent line or region in the proper way for the current major mode

This command is not bound to TAB by default as it is not Emacs+ policy to rebind fundamental keys, particularly when a key like TAB is overloaded within Eclipse and rebinding may interfere with this overloading (e.g. tabbing through method arguments during content assist). However, it can be bound to TAB on the keys preference page using the dropdown next to the Binding: key field entry. (Ensure that the When: field is set to Editing Text, so that the binding doesn't override the behavior of TAB in other contexts.)

The command uses heuristics to invoke the 'proper' indent command (if one can be found) for a given editor; else inserts tabs (or the equivalent spaces as described below). It should not be bound to Ctrl+I, as that will result in a no-op.

If called with Ctrl-U, then insert tabs or spaces at the beginning of the region and on each following line of the region.

Eclipse does not provide a way to reliably determine whether a given editor class has been configured to use tabs or spaces. Therefore, Emacs+ uses the setting of the 'primary' tabs preference (at General -> Editors -> Text Editors) to determine the most likely appropriate behavior (N.B. different editors use different preferences - or even internal heuristics - when inserting tabs/spaces).

To enable the use of Ctrl-<number> as digit-argument the Force digit-argument interpretation preference should be set. A number of editors/plugins use Ctrl-<some number> as either a command or a prefix argument (for example, the java editor uses Ctrl-2 as a prefix key for assorted Quick Assist functionality). When the preference is on, then all the Ctrl-<number> keys will always provide the digit-argument functionality. If the preference is off, then no overlapping Ctrl-<number> keys will provide the digit-argument functionality. To make sure that Eclipse's internal key bindings are built consistently, a restart of the workbench is strongly suggested whenever the preference is changed.

GNU-style shift select mode: Holding down the SHIFT key while typing a cursor motion command sets the mark before moving point so that the region extends from the original position of point to its new position. Any subsequent SHIFTED cursor motion command avoids setting the mark anew; therefore, a series of shifted cursor motion commands will continuously extend the region. In addition to the usual ways of deactivating the mark, the mark is deactivated by any UNSHIFTED cursor motion command.