1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<h4 class="subsection">Indentation Relative to Previous Lines</h4> <p>This section describes two commands that indent the current line based on the contents of previous lines. </p> <dl> <dt id="indent-relative">Command: <strong>indent-relative</strong> <em>&optional first-only unindented-ok</em>
</dt> <dd>
<p>This command inserts whitespace at point, extending to the same column as the next <em>indent point</em> of the previous nonblank line. An indent point is a non-whitespace character following whitespace. The next indent point is the first one at a column greater than the current column of point. For example, if point is underneath and to the left of the first non-blank character of a line of text, it moves to that column by inserting whitespace. </p> <p>If the previous nonblank line has no next indent point (i.e., none at a great enough column position), <code>indent-relative</code> either does nothing (if <var>unindented-ok</var> is non-<code>nil</code>) or calls <code>tab-to-tab-stop</code>. Thus, if point is underneath and to the right of the last column of a short line of text, this command ordinarily moves point to the next tab stop by inserting whitespace. </p> <p>If <var>first-only</var> is non-<code>nil</code>, only the first indent point is considered. </p> <p>The return value of <code>indent-relative</code> is unpredictable. </p> <p>In the following example, point is at the beginning of the second line: </p> <div class="example"> <pre class="example"> This line is indented twelve spaces.
∗The quick brown fox jumped.
</pre>
</div> <p>Evaluation of the expression <code>(indent-relative nil)</code> produces the following: </p> <div class="example"> <pre class="example"> This line is indented twelve spaces.
∗The quick brown fox jumped.
</pre>
</div> <p>In this next example, point is between the ‘<samp>m</samp>’ and ‘<samp>p</samp>’ of ‘<samp>jumped</samp>’: </p> <div class="example"> <pre class="example"> This line is indented twelve spaces.
The quick brown fox jum∗ped.
</pre>
</div> <p>Evaluation of the expression <code>(indent-relative nil)</code> produces the following: </p> <div class="example"> <pre class="example"> This line is indented twelve spaces.
The quick brown fox jum ∗ped.
</pre>
</div> </dd>
</dl> <dl> <dt id="indent-relative-first-indent-point">Command: <strong>indent-relative-first-indent-point</strong>
</dt> <dd>
<p>This command indents the current line like the previous nonblank line, by calling <code>indent-relative</code> with <code>t</code> as the <var>first-only</var> argument. The return value is unpredictable. </p> <p>If the previous nonblank line has no indent points beyond the current column, this command does nothing. </p>
</dd>
</dl><div class="_attribution">
<p class="_attribution-p">
Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Relative-Indent.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Relative-Indent.html</a>
</p>
</div>
|