Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Moving Around
         Simple Movement Commands
         Moving in Larger Units
         Searching
         . . .
         Comparing Many Files
      Changing Text
         . . .
         Regular Expressions
         Rearranging
         Indenting Commands
         Aligning
         Automatically Generated Text
         . . .
      Language Modes
         Asm Mode
         Batch Mode
         C Mode
         . . .
         Visual Basic Mode
      . . .

Previous   Up    Next
Formatting Text  Commands by Topic   Aligning


Epsilon User's Manual and Reference > Commands by Topic > Changing Text >

Indenting Commands

Epsilon can help with indenting your program or other text. The <Tab> key runs the indent-previous command, which makes the current line start at the same column as the previous non-blank line. Specifically, if you invoke this command with point in or adjacent to a line's indentation, indent-previous replaces that indentation with the indentation of the previous non-blank line. If point's indentation exceeds that of the previous non-blank line, or if you invoke this command with point outside of the line's indentation, this command simply inserts a <Tab>. See Customizing the Screen for information on changing the width of a tab.

Epsilon can automatically indent for you when you press <Enter>. Setting the buffer-specific variable auto-indent nonzero makes Epsilon do this. The way Epsilon indents depends on the current mode. For example, C mode knows how to indent for C programs. In Epsilon's default mode, fundamental mode, Epsilon indents like indent-previous if you set auto-indent nonzero. (Auto-indenting removes trailing spaces and tabs too.)

In some modes Epsilon not only indents the newly inserted line, but also reindents the existing line. Variables named after their modes, like c-reindent-previous-line, control this. The default-reindent-previous-line variable controls this for modes that don't have their own variable.

When Epsilon automatically inserts new lines for you in auto fill mode, it looks at a different variable to determine whether to indent these new lines. Epsilon indents in this case only if the buffer-specific variable auto-fill-indents has a nonzero value.

The Alt-m key moves point to the beginning of the text on the current line, just past the indentation.

The indent-under command functions like indent-previous, but each time you invoke it, it indents more, to align with the next word in the line above. In detail, it goes to the same column in the previous non-blank line, and looks to the right for the end of the next region of spaces and tabs. It indents the rest of the current line to that column after removing spaces and tabs from around point. With a highlighted region, it indents all lines in the region to that same column.

With a numeric prefix argument, indent-under goes to a different run of non-spaces. For instance, with an argument of 3, it goes to the previous line and finds the third word after the original column, then aligns the original line there.

The indent-rigidly command, bound to Ctrl-x Ctrl-i (or Ctrl-x <Tab>), changes the indentation of each line between point and mark by a fixed amount provided as a numeric argument. For instance, Ctrl-u 8 Ctrl-x Ctrl-i moves all the lines to the right by eight spaces. With no numeric argument, lines move to the right by the buffer's tab size (default 8; see Customizing the Screen), and with a negative numeric argument, lines move to the left. So, for example, Ctrl-u -1000 Ctrl-x Ctrl-i should remove all the indentation from the lines between point and mark.

If you highlight a region before pressing <Tab> (or any key that runs one of the commands indent-previous or do-c-indent), Epsilon indents all lines in the region by one tab stop, by calling the indent-rigidly command. You can provide a numeric argument to specify how much indentation you want.

The Shift-<Tab> key moves the cursor back to the previous tab stop. But if you highlight a region before pressing it, it will remove one tab stop's worth of indentation. (See the resize-rectangle-on-tab variable if you want these keys to instead change the region's shape without moving text.)

The indent-region command, bound to Ctrl-Alt-\, works similarly. It goes to the start of each line between point and mark and invokes the command bound to <Tab>. If the resulting line then contains only spaces and tabs, Epsilon removes them.

You can set up Epsilon to automatically reindent text when you yank it. Epsilon will indent like indent-region. By default, Epsilon does this only for C mode (see the reindent-after-c-yank variable).

To determine whether to reindent yanked text, the yank command first looks for a variable whose name is derived from the buffer's mode as it appears in the mode line: reindent-after-c-yank for C mode buffers, reindent-after-html-yank for HTML mode buffers, and so forth. If there's no variable by that name, Epsilon uses the reindent-after-yank variable instead. Instead of a variable, you can write an EEL function with the same name; Epsilon will call it and use its return value. See the description of reindent-after-yank for details on what different values do.

The Alt-s command horizontally centers the current line between the first column and the fill column by padding the left with spaces and tabs as necessary. Before centering the line, the command removes spaces and tabs from the beginning and end of the line.

With any of these commands, Epsilon indents by inserting as many tabs as possible without going past the desired column, and then inserting spaces as necessary to reach the column. You can set the size of a tab by setting the tab-size variable. Set the soft-tab-size variable if you want Epsilon to use one setting for displaying existing tab characters, and a different one for indenting.

If you prefer, you can make Epsilon indent using only spaces. The buffer-specific variable indent-with-tabs controls this behavior. Set it to 0 using set-variable to make Epsilon use only spaces when inserting indentation.

If you want <Tab> to simply indent to the next tab stop, you can bind the indent-to-tab-stop command to it. To disable smart indenting in a particular language mode, you can bind this command to <Tab> only in that mode.

The untabify-region command on Ctrl-x Alt-i changes all tab characters between point and mark to the number of spaces necessary to make the buffer look the same. The tabify-region command on Ctrl-x Alt-<Tab> does the reverse. It looks at all runs of spaces and tabs, and replaces each with tabs and spaces to occupy the same number of columns. The commands tabify-buffer and untabify-buffer are similar, but operate on the entire buffer, instead of just the region.

Standard bindings:

  Alt-m  to-indentation
 <Tab>  indent-previous
 Shift-<Tab>  back-to-tab-stop
 Ctrl-Alt-i  indent-under
 Ctrl-x <Tab>  indent-rigidly
 Ctrl-Alt-\   indent-region
 Alt-s  center-line
 Ctrl-x Alt-<Tab>  tabify-region
 Ctrl-x Alt-i  untabify-region
   tabify-buffer
   untabify-buffer
   indent-to-tab-stop
 



Previous   Up    Next
Formatting Text  Commands by Topic   Aligning


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.