328 |
} while (0) |
} while (0) |
329 |
|
|
330 |
DEFUN ("current-column", Fcurrent_column, Scurrent_column, 0, 0, 0, |
DEFUN ("current-column", Fcurrent_column, Scurrent_column, 0, 0, 0, |
331 |
"Return the horizontal position of point. Beginning of line is column 0.\n\ |
doc: /* Return the horizontal position of point. Beginning of line is column 0. |
332 |
This is calculated by adding together the widths of all the displayed\n\ |
This is calculated by adding together the widths of all the displayed |
333 |
representations of the character between the start of the previous line\n\ |
representations of the character between the start of the previous line |
334 |
and point. (eg control characters will have a width of 2 or 4, tabs\n\ |
and point. (eg control characters will have a width of 2 or 4, tabs |
335 |
will have a variable width)\n\ |
will have a variable width) |
336 |
Ignores finite width of frame, which means that this function may return\n\ |
Ignores finite width of frame, which means that this function may return |
337 |
values greater than (frame-width).\n\ |
values greater than (frame-width). |
338 |
Whether the line is visible (if `selective-display' is t) has no effect;\n\ |
Whether the line is visible (if `selective-display' is t) has no effect; |
339 |
however, ^M is treated as end of line when `selective-display' is t.") |
however, ^M is treated as end of line when `selective-display' is t. */) |
340 |
() |
() |
341 |
{ |
{ |
342 |
Lisp_Object temp; |
Lisp_Object temp; |
343 |
XSETFASTINT (temp, current_column ()); |
XSETFASTINT (temp, current_column ()); |
715 |
|
|
716 |
|
|
717 |
DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ", |
DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ", |
718 |
"Indent from point with tabs and spaces until COLUMN is reached.\n\ |
doc: /* Indent from point with tabs and spaces until COLUMN is reached. |
719 |
Optional second argument MININUM says always do at least MININUM spaces\n\ |
Optional second argument MININUM says always do at least MININUM spaces |
720 |
even if that goes past COLUMN; by default, MININUM is zero.") |
even if that goes past COLUMN; by default, MININUM is zero. */) |
721 |
(column, minimum) |
(column, minimum) |
722 |
Lisp_Object column, minimum; |
Lisp_Object column, minimum; |
723 |
{ |
{ |
724 |
int mincol; |
int mincol; |
766 |
static int position_indentation P_ ((int)); |
static int position_indentation P_ ((int)); |
767 |
|
|
768 |
DEFUN ("current-indentation", Fcurrent_indentation, Scurrent_indentation, |
DEFUN ("current-indentation", Fcurrent_indentation, Scurrent_indentation, |
769 |
0, 0, 0, |
0, 0, 0, |
770 |
"Return the indentation of the current line.\n\ |
doc: /* Return the indentation of the current line. |
771 |
This is the horizontal position of the character\n\ |
This is the horizontal position of the character |
772 |
following any initial whitespace.") |
following any initial whitespace. */) |
773 |
() |
() |
774 |
{ |
{ |
775 |
Lisp_Object val; |
Lisp_Object val; |
776 |
int opoint = PT, opoint_byte = PT_BYTE; |
int opoint = PT, opoint_byte = PT_BYTE; |
889 |
} |
} |
890 |
|
|
891 |
DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p", |
DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p", |
892 |
"Move point to column COLUMN in the current line.\n\ |
doc: /* Move point to column COLUMN in the current line. |
893 |
The column of a character is calculated by adding together the widths\n\ |
The column of a character is calculated by adding together the widths |
894 |
as displayed of the previous characters in the line.\n\ |
as displayed of the previous characters in the line. |
895 |
This function ignores line-continuation;\n\ |
This function ignores line-continuation; |
896 |
there is no upper limit on the column number a character can have\n\ |
there is no upper limit on the column number a character can have |
897 |
and horizontal scrolling has no effect.\n\ |
and horizontal scrolling has no effect. |
898 |
\n\ |
|
899 |
If specified column is within a character, point goes after that character.\n\ |
If specified column is within a character, point goes after that character. |
900 |
If it's past end of line, point goes to end of line.\n\n\ |
If it's past end of line, point goes to end of line. |
901 |
A non-nil second (optional) argument FORCE means,\n\ |
|
902 |
if COLUMN is in the middle of a tab character, change it to spaces.\n\ |
A non-nil second (optional) argument FORCE means, |
903 |
In addition, if FORCE is t, and the line is too short\n\ |
if COLUMN is in the middle of a tab character, change it to spaces. |
904 |
to reach column COLUMN, add spaces/tabs to get there.\n\ |
In addition, if FORCE is t, and the line is too short |
905 |
\n\ |
to reach column COLUMN, add spaces/tabs to get there. |
906 |
The return value is the current column.") |
|
907 |
(column, force) |
The return value is the current column. */) |
908 |
|
(column, force) |
909 |
Lisp_Object column, force; |
Lisp_Object column, force; |
910 |
{ |
{ |
911 |
register int pos; |
register int pos; |
1699 |
} |
} |
1700 |
|
|
1701 |
|
|
|
#if 0 /* The doc string is too long for some compilers, |
|
|
but make-docfile can find it in this comment. */ |
|
|
DEFUN ("compute-motion", Ffoo, Sfoo, 7, 7, 0, |
|
|
"Scan through the current buffer, calculating screen position.\n\ |
|
|
Scan the current buffer forward from offset FROM,\n\ |
|
|
assuming it is at position FROMPOS--a cons of the form (HPOS . VPOS)--\n\ |
|
|
to position TO or position TOPOS--another cons of the form (HPOS . VPOS)--\n\ |
|
|
and return the ending buffer position and screen location.\n\ |
|
|
\n\ |
|
|
There are three additional arguments:\n\ |
|
|
\n\ |
|
|
WIDTH is the number of columns available to display text;\n\ |
|
|
this affects handling of continuation lines.\n\ |
|
|
This is usually the value returned by `window-width', less one (to allow\n\ |
|
|
for the continuation glyph).\n\ |
|
|
\n\ |
|
|
OFFSETS is either nil or a cons cell (HSCROLL . TAB-OFFSET).\n\ |
|
|
HSCROLL is the number of columns not being displayed at the left\n\ |
|
|
margin; this is usually taken from a window's hscroll member.\n\ |
|
|
TAB-OFFSET is the number of columns of the first tab that aren't\n\ |
|
|
being displayed, perhaps because the line was continued within it.\n\ |
|
|
If OFFSETS is nil, HSCROLL and TAB-OFFSET are assumed to be zero.\n\ |
|
|
\n\ |
|
|
WINDOW is the window to operate on. It is used to choose the display table;\n\ |
|
|
if it is showing the current buffer, it is used also for\n\ |
|
|
deciding which overlay properties apply.\n\ |
|
|
Note that `compute-motion' always operates on the current buffer.\n\ |
|
|
\n\ |
|
|
The value is a list of five elements:\n\ |
|
|
(POS HPOS VPOS PREVHPOS CONTIN)\n\ |
|
|
POS is the buffer position where the scan stopped.\n\ |
|
|
VPOS is the vertical position where the scan stopped.\n\ |
|
|
HPOS is the horizontal position where the scan stopped.\n\ |
|
|
\n\ |
|
|
PREVHPOS is the horizontal position one character back from POS.\n\ |
|
|
CONTIN is t if a line was continued after (or within) the previous character.\n\ |
|
|
\n\ |
|
|
For example, to find the buffer position of column COL of line LINE\n\ |
|
|
of a certain window, pass the window's starting location as FROM\n\ |
|
|
and the window's upper-left coordinates as FROMPOS.\n\ |
|
|
Pass the buffer's (point-max) as TO, to limit the scan to the end of the\n\ |
|
|
visible section of the buffer, and pass LINE and COL as TOPOS.") |
|
|
(from, frompos, to, topos, width, offsets, window) |
|
|
#endif |
|
|
|
|
1702 |
DEFUN ("compute-motion", Fcompute_motion, Scompute_motion, 7, 7, 0, |
DEFUN ("compute-motion", Fcompute_motion, Scompute_motion, 7, 7, 0, |
1703 |
0) |
doc: /* Scan through the current buffer, calculating screen position. |
1704 |
(from, frompos, to, topos, width, offsets, window) |
Scan the current buffer forward from offset FROM, |
1705 |
|
assuming it is at position FROMPOS--a cons of the form (HPOS . VPOS)-- |
1706 |
|
to position TO or position TOPOS--another cons of the form (HPOS . VPOS)-- |
1707 |
|
and return the ending buffer position and screen location. |
1708 |
|
|
1709 |
|
There are three additional arguments: |
1710 |
|
|
1711 |
|
WIDTH is the number of columns available to display text; |
1712 |
|
this affects handling of continuation lines. |
1713 |
|
This is usually the value returned by `window-width', less one (to allow |
1714 |
|
for the continuation glyph). |
1715 |
|
|
1716 |
|
OFFSETS is either nil or a cons cell (HSCROLL . TAB-OFFSET). |
1717 |
|
HSCROLL is the number of columns not being displayed at the left |
1718 |
|
margin; this is usually taken from a window's hscroll member. |
1719 |
|
TAB-OFFSET is the number of columns of the first tab that aren't |
1720 |
|
being displayed, perhaps because the line was continued within it. |
1721 |
|
If OFFSETS is nil, HSCROLL and TAB-OFFSET are assumed to be zero. |
1722 |
|
|
1723 |
|
WINDOW is the window to operate on. It is used to choose the display table; |
1724 |
|
if it is showing the current buffer, it is used also for |
1725 |
|
deciding which overlay properties apply. |
1726 |
|
Note that `compute-motion' always operates on the current buffer. |
1727 |
|
|
1728 |
|
The value is a list of five elements: |
1729 |
|
(POS HPOS VPOS PREVHPOS CONTIN) |
1730 |
|
POS is the buffer position where the scan stopped. |
1731 |
|
VPOS is the vertical position where the scan stopped. |
1732 |
|
HPOS is the horizontal position where the scan stopped. |
1733 |
|
|
1734 |
|
PREVHPOS is the horizontal position one character back from POS. |
1735 |
|
CONTIN is t if a line was continued after (or within) the previous character. |
1736 |
|
|
1737 |
|
For example, to find the buffer position of column COL of line LINE |
1738 |
|
of a certain window, pass the window's starting location as FROM |
1739 |
|
and the window's upper-left coordinates as FROMPOS. |
1740 |
|
Pass the buffer's (point-max) as TO, to limit the scan to the end of the |
1741 |
|
visible section of the buffer, and pass LINE and COL as TOPOS. */) |
1742 |
|
(from, frompos, to, topos, width, offsets, window) |
1743 |
Lisp_Object from, frompos, to, topos; |
Lisp_Object from, frompos, to, topos; |
1744 |
Lisp_Object width, offsets, window; |
Lisp_Object width, offsets, window; |
1745 |
{ |
{ |
1947 |
} |
} |
1948 |
|
|
1949 |
DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0, |
DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0, |
1950 |
"Move point to start of the screen line LINES lines down.\n\ |
doc: /* Move point to start of the screen line LINES lines down. |
1951 |
If LINES is negative, this means moving up.\n\ |
If LINES is negative, this means moving up. |
1952 |
\n\ |
|
1953 |
This function is an ordinary cursor motion function\n\ |
This function is an ordinary cursor motion function |
1954 |
which calculates the new position based on how text would be displayed.\n\ |
which calculates the new position based on how text would be displayed. |
1955 |
The new position may be the start of a line,\n\ |
The new position may be the start of a line, |
1956 |
or just the start of a continuation line.\n\ |
or just the start of a continuation line. |
1957 |
The function returns number of screen lines moved over;\n\ |
The function returns number of screen lines moved over; |
1958 |
that usually equals LINES, but may be closer to zero\n\ |
that usually equals LINES, but may be closer to zero |
1959 |
if beginning or end of buffer was reached.\n\ |
if beginning or end of buffer was reached. |
1960 |
\n\ |
|
1961 |
The optional second argument WINDOW specifies the window to use for\n\ |
The optional second argument WINDOW specifies the window to use for |
1962 |
parameters such as width, horizontal scrolling, and so on.\n\ |
parameters such as width, horizontal scrolling, and so on. |
1963 |
The default is to use the selected window's parameters.\n\ |
The default is to use the selected window's parameters. |
1964 |
\n\ |
|
1965 |
`vertical-motion' always uses the current buffer,\n\ |
`vertical-motion' always uses the current buffer, |
1966 |
regardless of which buffer is displayed in WINDOW.\n\ |
regardless of which buffer is displayed in WINDOW. |
1967 |
This is consistent with other cursor motion functions\n\ |
This is consistent with other cursor motion functions |
1968 |
and makes it possible to use `vertical-motion' in any buffer,\n\ |
and makes it possible to use `vertical-motion' in any buffer, |
1969 |
whether or not it is currently displayed in some window.") |
whether or not it is currently displayed in some window. */) |
1970 |
(lines, window) |
(lines, window) |
1971 |
Lisp_Object lines, window; |
Lisp_Object lines, window; |
1972 |
{ |
{ |
1973 |
struct it it; |
struct it it; |
2011 |
syms_of_indent () |
syms_of_indent () |
2012 |
{ |
{ |
2013 |
DEFVAR_BOOL ("indent-tabs-mode", &indent_tabs_mode, |
DEFVAR_BOOL ("indent-tabs-mode", &indent_tabs_mode, |
2014 |
"*Indentation can insert tabs if this is non-nil.\n\ |
doc: /* *Indentation can insert tabs if this is non-nil. |
2015 |
Setting this variable automatically makes it local to the current buffer."); |
Setting this variable automatically makes it local to the current buffer. */); |
2016 |
indent_tabs_mode = 1; |
indent_tabs_mode = 1; |
2017 |
|
|
2018 |
defsubr (&Scurrent_indentation); |
defsubr (&Scurrent_indentation); |