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/columns.html | |
new repository
Diffstat (limited to 'devdocs/elisp/columns.html')
| -rw-r--r-- | devdocs/elisp/columns.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/devdocs/elisp/columns.html b/devdocs/elisp/columns.html new file mode 100644 index 00000000..71686d81 --- /dev/null +++ b/devdocs/elisp/columns.html @@ -0,0 +1,12 @@ + <h3 class="section">Counting Columns</h3> <p>The column functions convert between a character position (counting characters from the beginning of the buffer) and a column position (counting screen characters from the beginning of a line). </p> <p>These functions count each character according to the number of columns it occupies on the screen. This means control characters count as occupying 2 or 4 columns, depending upon the value of <code>ctl-arrow</code>, and tabs count as occupying a number of columns that depends on the value of <code>tab-width</code> and on the column where the tab begins. See <a href="usual-display">Usual Display</a>. </p> <p>Column number computations ignore the width of the window and the amount of horizontal scrolling. Consequently, a column value can be arbitrarily high. The first (or leftmost) column is numbered 0. They also ignore overlays and text properties, aside from invisibility. Invisible text is considered as having zero width, unless <code>buffer-invisibility-spec</code> specifies that invisible text should be displayed as ellipsis (see <a href="invisible-text">Invisible Text</a>). </p> <dl> <dt id="current-column">Function: <strong>current-column</strong> +</dt> <dd><p>This function returns the horizontal position of point, measured in columns, counting from 0 at the left margin. The column position is the sum of the widths of all the displayed representations of the characters between the start of the current line and point. </p></dd> +</dl> <dl> <dt id="move-to-column">Command: <strong>move-to-column</strong> <em>column &optional force</em> +</dt> <dd> +<p>This function moves point to <var>column</var> in the current line. The calculation of <var>column</var> takes into account the widths of the displayed representations of the characters between the start of the line and point. </p> <p>When called interactively, <var>column</var> is the value of prefix numeric argument. If <var>column</var> is not an integer, an error is signaled. </p> <p>If it is impossible to move to column <var>column</var> because that is in the middle of a multicolumn character such as a tab, point moves to the end of that character. However, if <var>force</var> is non-<code>nil</code>, and <var>column</var> is in the middle of a tab, then <code>move-to-column</code> either converts the tab into spaces (when <code>indent-tabs-mode</code> is <code>nil</code>), or inserts enough spaces before it (otherwise), so that point can move precisely to column <var>column</var>. Other multicolumn characters can cause anomalies despite <var>force</var>, since there is no way to split them. </p> <p>The argument <var>force</var> also has an effect if the line isn’t long enough to reach column <var>column</var>; if it is <code>t</code>, that means to add whitespace at the end of the line to reach that column. </p> <p>The return value is the column number actually moved to. </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/Columns.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Columns.html</a> + </p> +</div> |
