diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/relative-indent.html | |
new repository
Diffstat (limited to 'devdocs/elisp/relative-indent.html')
| -rw-r--r-- | devdocs/elisp/relative-indent.html | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/devdocs/elisp/relative-indent.html b/devdocs/elisp/relative-indent.html new file mode 100644 index 00000000..d6f01263 --- /dev/null +++ b/devdocs/elisp/relative-indent.html @@ -0,0 +1,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> |
