HCoop
/
bpt
/
emacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New primitive secure-hash supporting md5, sha-1 and sha-2
[bpt/emacs.git]
/
src
/
indent.c
diff --git
a/src/indent.c
b/src/indent.c
index
e965daf
..
57a4548
100644
(file)
--- a/
src/indent.c
+++ b/
src/indent.c
@@
-1,6
+1,5
@@
/* Indentation functions.
/* Indentation functions.
- Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1998, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2011
Free Software Foundation, Inc.
This file is part of GNU Emacs.
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@
-38,11
+37,6
@@
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "dispextern.h"
#include "region-cache.h"
#include "dispextern.h"
#include "region-cache.h"
-/* Indentation can insert tabs if this is non-zero;
- otherwise always uses spaces. */
-
-static int indent_tabs_mode;
-
#define CR 015
/* These three values memorize the current column to avoid recalculation. */
#define CR 015
/* These three values memorize the current column to avoid recalculation. */
@@
-51,7
+45,7
@@
static int indent_tabs_mode;
Some things in set last_known_column_point to -1
to mark the memorized value as invalid. */
Some things in set last_known_column_point to -1
to mark the memorized value as invalid. */
-static
double
last_known_column;
+static
EMACS_INT
last_known_column;
/* Value of point when current_column was called. */
/* Value of point when current_column was called. */
@@
-61,8
+55,8
@@
EMACS_INT last_known_column_point;
static int last_known_column_modified;
static int last_known_column_modified;
-static
double current_column_1 P_ ((void)
);
-static
double position_indentation P_ ((int)
);
+static
EMACS_INT current_column_1 (void
);
+static
EMACS_INT position_indentation (int
);
/* Cache of beginning of line found by the last call of
current_column. */
/* Cache of beginning of line found by the last call of
current_column. */
@@
-72,11
+66,11
@@
static EMACS_INT current_column_bol_cache;
/* Get the display table to use for the current buffer. */
struct Lisp_Char_Table *
/* Get the display table to use for the current buffer. */
struct Lisp_Char_Table *
-buffer_display_table ()
+buffer_display_table (
void
)
{
Lisp_Object thisbuf;
{
Lisp_Object thisbuf;
- thisbuf =
current_buffer->display_table
;
+ thisbuf =
BVAR (current_buffer, display_table)
;
if (DISP_TABLE_P (thisbuf))
return XCHAR_TABLE (thisbuf);
if (DISP_TABLE_P (Vstandard_display_table))
if (DISP_TABLE_P (thisbuf))
return XCHAR_TABLE (thisbuf);
if (DISP_TABLE_P (Vstandard_display_table))
@@
-89,9
+83,7
@@
buffer_display_table ()
/* Return the width of character C under display table DP. */
static int
/* Return the width of character C under display table DP. */
static int
-character_width (c, dp)
- int c;
- struct Lisp_Char_Table *dp;
+character_width (int c, struct Lisp_Char_Table *dp)
{
Lisp_Object elt;
{
Lisp_Object elt;
@@
-101,7
+93,7
@@
character_width (c, dp)
/* Everything can be handled by the display table, if it's
present and the element is right. */
if (dp && (elt = DISP_CHAR_VECTOR (dp, c), VECTORP (elt)))
/* Everything can be handled by the display table, if it's
present and the element is right. */
if (dp && (elt = DISP_CHAR_VECTOR (dp, c), VECTORP (elt)))
- return
XVECTOR_
SIZE (elt);
+ return
A
SIZE (elt);
/* Some characters are special. */
if (c == '\n' || c == '\t' || c == '\015')
/* Some characters are special. */
if (c == '\n' || c == '\t' || c == '\015')
@@
-125,9
+117,7
@@
character_width (c, dp)
invalidate the buffer's width_run_cache. */
int
invalidate the buffer's width_run_cache. */
int
-disptab_matches_widthtab (disptab, widthtab)
- struct Lisp_Char_Table *disptab;
- struct Lisp_Vector *widthtab;
+disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *widthtab)
{
int i;
{
int i;
@@
-145,16
+135,14
@@
disptab_matches_widthtab (disptab, widthtab)
/* Recompute BUF's width table, using the display table DISPTAB. */
void
/* Recompute BUF's width table, using the display table DISPTAB. */
void
-recompute_width_table (buf, disptab)
- struct buffer *buf;
- struct Lisp_Char_Table *disptab;
+recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
{
int i;
struct Lisp_Vector *widthtab;
{
int i;
struct Lisp_Vector *widthtab;
- if (!VECTORP (
buf->width_table
))
-
buf->width_table
= Fmake_vector (make_number (256), make_number (0));
- widthtab = XVECTOR (
buf->width_table
);
+ if (!VECTORP (
BVAR (buf, width_table)
))
+
BVAR (buf, width_table)
= Fmake_vector (make_number (256), make_number (0));
+ widthtab = XVECTOR (
BVAR (buf, width_table)
);
if (widthtab->header.size != 256)
abort ();
if (widthtab->header.size != 256)
abort ();
@@
-166,19
+154,19
@@
recompute_width_table (buf, disptab)
state of current_buffer's cache_long_line_scans variable. */
static void
state of current_buffer's cache_long_line_scans variable. */
static void
-width_run_cache_on_off ()
+width_run_cache_on_off (
void
)
{
{
- if (NILP (
current_buffer->cache_long_line_scans
)
+ if (NILP (
BVAR (current_buffer, cache_long_line_scans)
)
/* And, for the moment, this feature doesn't work on multibyte
characters. */
/* And, for the moment, this feature doesn't work on multibyte
characters. */
- || !NILP (
current_buffer->enable_multibyte_characters
))
+ || !NILP (
BVAR (current_buffer, enable_multibyte_characters)
))
{
/* It should be off. */
if (current_buffer->width_run_cache)
{
free_region_cache (current_buffer->width_run_cache);
current_buffer->width_run_cache = 0;
{
/* It should be off. */
if (current_buffer->width_run_cache)
{
free_region_cache (current_buffer->width_run_cache);
current_buffer->width_run_cache = 0;
-
current_buffer->width_table
= Qnil;
+
BVAR (current_buffer, width_table)
= Qnil;
}
}
else
}
}
else
@@
-217,11
+205,7
@@
width_run_cache_on_off ()
will equal the return value. */
EMACS_INT
will equal the return value. */
EMACS_INT
-skip_invisible (pos, next_boundary_p, to, window)
- EMACS_INT pos;
- EMACS_INT *next_boundary_p;
- EMACS_INT to;
- Lisp_Object window;
+skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Object window)
{
Lisp_Object prop, position, overlay_limit, proplimit;
Lisp_Object buffer, tmp;
{
Lisp_Object prop, position, overlay_limit, proplimit;
Lisp_Object buffer, tmp;
@@
-287,25
+271,22
@@
skip_invisible (pos, next_boundary_p, to, window)
DP is a display table or NULL.
DP is a display table or NULL.
- This macro is used in
current_column_1, Fmove_to_column, and
+ This macro is used in
scan_for_column and in
compute_motion. */
compute_motion. */
-#define MULTIBYTE_BYTES_WIDTH(p, dp
)
\
+#define MULTIBYTE_BYTES_WIDTH(p, dp
, bytes, width)
\
do { \
do { \
- int c
;
\
+ int c
h;
\
\
\
- wide_column = 0; \
- c = STRING_CHAR_AND_LENGTH (p, bytes); \
+ ch = STRING_CHAR_AND_LENGTH (p, bytes); \
if (BYTES_BY_CHAR_HEAD (*p) != bytes) \
width = bytes * 4; \
else \
{ \
if (BYTES_BY_CHAR_HEAD (*p) != bytes) \
width = bytes * 4; \
else \
{ \
- if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c
)))
\
- width =
XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, c));
\
+ if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c
h)))
\
+ width =
ASIZE (DISP_CHAR_VECTOR (dp, ch));
\
else \
else \
- width = CHAR_WIDTH (c); \
- if (width > 1) \
- wide_column = width; \
+ width = CHAR_WIDTH (ch); \
} \
} while (0)
} \
} while (0)
@@
-322,31
+303,31
@@
Whether the line is visible (if `selective-display' is t) has no effect;
however, ^M is treated as end of line when `selective-display' is t.
Text that has an invisible property is considered as having width 0, unless
`buffer-invisibility-spec' specifies that it is replaced by an ellipsis. */)
however, ^M is treated as end of line when `selective-display' is t.
Text that has an invisible property is considered as having width 0, unless
`buffer-invisibility-spec' specifies that it is replaced by an ellipsis. */)
-
(
)
+
(void
)
{
Lisp_Object temp;
{
Lisp_Object temp;
- XSETFASTINT (temp,
(int) current_column ()); /* iftc */
+ XSETFASTINT (temp,
current_column ());
return temp;
}
/* Cancel any recorded value of the horizontal position. */
void
return temp;
}
/* Cancel any recorded value of the horizontal position. */
void
-invalidate_current_column ()
+invalidate_current_column (
void
)
{
last_known_column_point = 0;
}
{
last_known_column_point = 0;
}
-double
-current_column ()
+EMACS_INT
+current_column (
void
)
{
{
- register
int
col;
+ register
EMACS_INT
col;
register unsigned char *ptr, *stop;
register int tab_seen;
register unsigned char *ptr, *stop;
register int tab_seen;
-
int
post_tab;
+
EMACS_INT
post_tab;
register int c;
register int c;
- register
int tab_width = XINT (current_buffer->tab_width
);
- int ctl_arrow = !NILP (
current_buffer->ctl_arrow
);
+ register
EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width)
);
+ int ctl_arrow = !NILP (
BVAR (current_buffer, ctl_arrow)
);
register struct Lisp_Char_Table *dp = buffer_display_table ();
if (PT == last_known_column_point
register struct Lisp_Char_Table *dp = buffer_display_table ();
if (PT == last_known_column_point
@@
-433,7
+414,7
@@
current_column ()
col++;
else if (c == '\n'
|| (c == '\r'
col++;
else if (c == '\n'
|| (c == '\r'
- && EQ (
current_buffer->selective_display
, Qt)))
+ && EQ (
BVAR (current_buffer, selective_display)
, Qt)))
{
ptr++;
goto start_of_line_found;
{
ptr++;
goto start_of_line_found;
@@
-479,7
+460,6
@@
current_column ()
return col;
}
\f
return col;
}
\f
-extern Lisp_Object Qspace, QCwidth, QCalign_to;
/* Check the presence of a display property and compute its width.
If a property was found and its width was found as well, return
/* Check the presence of a display property and compute its width.
If a property was found and its width was found as well, return
@@
-506,7
+486,7
@@
check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
width = XINT (prop) - col;
else if (FLOATP (prop))
width = (int)(XFLOAT_DATA (prop) + 0.5) - col;
width = XINT (prop) - col;
else if (FLOATP (prop))
width = (int)(XFLOAT_DATA (prop) + 0.5) - col;
-
+
if (width >= 0)
{
EMACS_INT start;
if (width >= 0)
{
EMACS_INT start;
@@
-529,10
+509,10
@@
check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
static void
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
{
static void
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
{
- register EMACS_INT tab_width = XINT (
current_buffer->tab_width
);
- register int ctl_arrow = !NILP (
current_buffer->ctl_arrow
);
+ register EMACS_INT tab_width = XINT (
BVAR (current_buffer, tab_width)
);
+ register int ctl_arrow = !NILP (
BVAR (current_buffer, ctl_arrow)
);
register struct Lisp_Char_Table *dp = buffer_display_table ();
register struct Lisp_Char_Table *dp = buffer_display_table ();
- int multibyte = !NILP (
current_buffer->enable_multibyte_characters
);
+ int multibyte = !NILP (
BVAR (current_buffer, enable_multibyte_characters)
);
struct composition_it cmp_it;
Lisp_Object window;
struct window *w;
struct composition_it cmp_it;
Lisp_Object window;
struct window *w;
@@
-556,7
+536,7
@@
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
w = ! NILP (window) ? XWINDOW (window) : NULL;
if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
w = ! NILP (window) ? XWINDOW (window) : NULL;
if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
-
bzero (&cmp_it
, sizeof cmp_it);
+
memset (&cmp_it, 0
, sizeof cmp_it);
cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
@@
-586,14
+566,14
@@
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
prev_col = col;
{ /* Check display property. */
prev_col = col;
{ /* Check display property. */
- EMACS_INT end;
- int width = check_display_width (scan, col, &end);
+ EMACS_INT end
p
;
+ int width = check_display_width (scan, col, &end
p
);
if (width >= 0)
{
col += width;
if (width >= 0)
{
col += width;
- if (end > scan) /* Avoid infinite loops with 0-width overlays. */
+ if (end
p
> scan) /* Avoid infinite loops with 0-width overlays. */
{
{
- scan = end; scan_byte = charpos_to_bytepos (scan);
+ scan = end
p
; scan_byte = charpos_to_bytepos (scan);
continue;
}
}
continue;
}
}
@@
-628,7
+608,7
@@
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
to this character. */
if (dp != 0
to this character. */
if (dp != 0
- && ! (multibyte &&
BASE_
LEADING_CODE_P (c))
+ && ! (multibyte && LEADING_CODE_P (c))
&& VECTORP (DISP_CHAR_VECTOR (dp, c)))
{
Lisp_Object charvec;
&& VECTORP (DISP_CHAR_VECTOR (dp, c)))
{
Lisp_Object charvec;
@@
-654,7
+634,7
@@
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
if (c == '\n')
goto endloop;
if (c == '\n')
goto endloop;
- if (c == '\r' && EQ (
current_buffer->selective_display
, Qt))
+ if (c == '\r' && EQ (
BVAR (current_buffer, selective_display)
, Qt))
goto endloop;
if (c == '\t')
{
goto endloop;
if (c == '\t')
{
@@
-672,21
+652,21
@@
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
if (c == '\n')
goto endloop;
if (c == '\n')
goto endloop;
- if (c == '\r' && EQ (
current_buffer->selective_display
, Qt))
+ if (c == '\r' && EQ (
BVAR (current_buffer, selective_display)
, Qt))
goto endloop;
if (c == '\t')
{
col += tab_width;
col = col / tab_width * tab_width;
}
goto endloop;
if (c == '\t')
{
col += tab_width;
col = col / tab_width * tab_width;
}
- else if (multibyte &&
BASE_
LEADING_CODE_P (c))
+ else if (multibyte && LEADING_CODE_P (c))
{
/* Start of multi-byte form. */
unsigned char *ptr;
{
/* Start of multi-byte form. */
unsigned char *ptr;
- int bytes, width
, wide_column
;
+ int bytes, width;
ptr = BYTE_POS_ADDR (scan_byte);
ptr = BYTE_POS_ADDR (scan_byte);
- MULTIBYTE_BYTES_WIDTH (ptr, dp);
+ MULTIBYTE_BYTES_WIDTH (ptr, dp
, bytes, width
);
/* Subtract one to compensate for the increment
that is going to happen below. */
scan_byte += bytes - 1;
/* Subtract one to compensate for the increment
that is going to happen below. */
scan_byte += bytes - 1;
@@
-722,8
+702,8
@@
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
This function handles characters that are invisible
due to text properties or overlays. */
This function handles characters that are invisible
due to text properties or overlays. */
-static
double
-current_column_1 ()
+static
EMACS_INT
+current_column_1 (
void
)
{
EMACS_INT col = MOST_POSITIVE_FIXNUM;
EMACS_INT opoint = PT;
{
EMACS_INT col = MOST_POSITIVE_FIXNUM;
EMACS_INT opoint = PT;
@@
-786,7
+766,7
@@
string_display_width (string, beg, end)
c = *--ptr;
if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
c = *--ptr;
if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
- col +=
XVECTOR_
SIZE (DISP_CHAR_VECTOR (dp, c));
+ col +=
A
SIZE (DISP_CHAR_VECTOR (dp, c));
else if (c >= 040 && c < 0177)
col++;
else if (c == '\n')
else if (c >= 040 && c < 0177)
col++;
else if (c == '\n')
@@
-822,12
+802,11
@@
Optional second argument MINIMUM says always do at least MINIMUM spaces
even if that goes past COLUMN; by default, MINIMUM is zero.
The return value is COLUMN. */)
even if that goes past COLUMN; by default, MINIMUM is zero.
The return value is COLUMN. */)
- (column, minimum)
- Lisp_Object column, minimum;
+ (Lisp_Object column, Lisp_Object minimum)
{
{
-
int
mincol;
- register
int
fromcol;
- register
int tab_width = XINT (current_buffer->tab_width
);
+
EMACS_INT
mincol;
+ register
EMACS_INT
fromcol;
+ register
EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width)
);
CHECK_NUMBER (column);
if (NILP (minimum))
CHECK_NUMBER (column);
if (NILP (minimum))
@@
-867,31
+846,28
@@
The return value is COLUMN. */)
}
\f
}
\f
-static double position_indentation P_ ((int));
-
DEFUN ("current-indentation", Fcurrent_indentation, Scurrent_indentation,
0, 0, 0,
doc: /* Return the indentation of the current line.
This is the horizontal position of the character
following any initial whitespace. */)
DEFUN ("current-indentation", Fcurrent_indentation, Scurrent_indentation,
0, 0, 0,
doc: /* Return the indentation of the current line.
This is the horizontal position of the character
following any initial whitespace. */)
-
(
)
+
(void
)
{
Lisp_Object val;
{
Lisp_Object val;
-
int
opoint = PT, opoint_byte = PT_BYTE;
+
EMACS_INT
opoint = PT, opoint_byte = PT_BYTE;
scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1);
scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1);
- XSETFASTINT (val,
(int) position_indentation (PT_BYTE)); /* iftc */
+ XSETFASTINT (val,
position_indentation (PT_BYTE));
SET_PT_BOTH (opoint, opoint_byte);
return val;
}
SET_PT_BOTH (opoint, opoint_byte);
return val;
}
-static double
-position_indentation (pos_byte)
- register int pos_byte;
+static EMACS_INT
+position_indentation (register int pos_byte)
{
register EMACS_INT column = 0;
{
register EMACS_INT column = 0;
- register EMACS_INT tab_width = XINT (
current_buffer->tab_width
);
+ register EMACS_INT tab_width = XINT (
BVAR (current_buffer, tab_width)
);
register unsigned char *p;
register unsigned char *stop;
unsigned char *start;
register unsigned char *p;
register unsigned char *stop;
unsigned char *start;
@@
-943,7
+919,7
@@
position_indentation (pos_byte)
switch (*p++)
{
case 0240:
switch (*p++)
{
case 0240:
- if (! NILP (
current_buffer->enable_multibyte_characters
))
+ if (! NILP (
BVAR (current_buffer, enable_multibyte_characters)
))
return column;
case ' ':
column++;
return column;
case ' ':
column++;
@@
-953,7
+929,7
@@
position_indentation (pos_byte)
break;
default:
if (ASCII_BYTE_P (p[-1])
break;
default:
if (ASCII_BYTE_P (p[-1])
- || NILP (
current_buffer->enable_multibyte_characters
))
+ || NILP (
BVAR (current_buffer, enable_multibyte_characters)
))
return column;
{
int c;
return column;
{
int c;
@@
-977,12
+953,10
@@
position_indentation (pos_byte)
preceding line. */
int
preceding line. */
int
-indented_beyond_p (pos, pos_byte, column)
- int pos, pos_byte;
- double column;
+indented_beyond_p (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT column)
{
{
-
double
val;
-
int
opoint = PT, opoint_byte = PT_BYTE;
+
EMACS_INT
val;
+
EMACS_INT
opoint = PT, opoint_byte = PT_BYTE;
SET_PT_BOTH (pos, pos_byte);
while (PT > BEGV && FETCH_BYTE (PT_BYTE) == '\n')
SET_PT_BOTH (pos, pos_byte);
while (PT > BEGV && FETCH_BYTE (PT_BYTE) == '\n')
@@
-990,7
+964,7
@@
indented_beyond_p (pos, pos_byte, column)
val = position_indentation (PT_BYTE);
SET_PT_BOTH (opoint, opoint_byte);
val = position_indentation (PT_BYTE);
SET_PT_BOTH (opoint, opoint_byte);
- return val >= column;
/* hmm, float comparison */
+ return val >= column;
}
\f
DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p",
}
\f
DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p",
@@
-1011,8
+985,7
@@
In addition, if FORCE is t, and the line is too short to reach
COLUMN, add spaces/tabs to get there.
The return value is the current column. */)
COLUMN, add spaces/tabs to get there.
The return value is the current column. */)
- (column, force)
- Lisp_Object column, force;
+ (Lisp_Object column, Lisp_Object force)
{
EMACS_INT pos;
EMACS_INT col, prev_col;
{
EMACS_INT pos;
EMACS_INT col, prev_col;
@@
-1071,7
+1044,7
@@
The return value is the current column. */)
\f
/* compute_motion: compute buffer posn given screen posn and vice versa */
\f
/* compute_motion: compute buffer posn given screen posn and vice versa */
-struct position val_compute_motion;
+st
atic st
ruct position val_compute_motion;
/* Scan the current buffer forward from offset FROM, pretending that
this is at line FROMVPOS, column FROMHPOS, until reaching buffer
/* Scan the current buffer forward from offset FROM, pretending that
this is at line FROMVPOS, column FROMHPOS, until reaching buffer
@@
-1129,20
+1102,15
@@
struct position val_compute_motion;
WINDOW_HAS_VERTICAL_SCROLL_BAR (window)
and frame_cols = FRAME_COLS (XFRAME (window->frame))
WINDOW_HAS_VERTICAL_SCROLL_BAR (window)
and frame_cols = FRAME_COLS (XFRAME (window->frame))
- Or you can let window_bo
x_text
_cols do this all for you, and write:
- window_bo
x_text
_cols (w) - 1
+ Or you can let window_bo
dy
_cols do this all for you, and write:
+ window_bo
dy
_cols (w) - 1
The `-1' accounts for the continuation-line backslashes; the rest
accounts for window borders if the window is split horizontally, and
the scroll bars if they are turned on. */
struct position *
The `-1' accounts for the continuation-line backslashes; the rest
accounts for window borders if the window is split horizontally, and
the scroll bars if they are turned on. */
struct position *
-compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, hscroll, tab_offset, win)
- EMACS_INT from, fromvpos, fromhpos, to, tovpos, tohpos;
- int did_motion;
- EMACS_INT width;
- EMACS_INT hscroll, tab_offset;
- struct window *win;
+compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_motion, EMACS_INT to, EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, EMACS_INT hscroll, EMACS_INT tab_offset, struct window *win)
{
register EMACS_INT hpos = fromhpos;
register EMACS_INT vpos = fromvpos;
{
register EMACS_INT hpos = fromhpos;
register EMACS_INT vpos = fromvpos;
@@
-1150,16
+1118,16
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
register EMACS_INT pos;
EMACS_INT pos_byte;
register int c = 0;
register EMACS_INT pos;
EMACS_INT pos_byte;
register int c = 0;
- register EMACS_INT tab_width = XFASTINT (
current_buffer->tab_width
);
- register int ctl_arrow = !NILP (
current_buffer->ctl_arrow
);
+ register EMACS_INT tab_width = XFASTINT (
BVAR (current_buffer, tab_width)
);
+ register int ctl_arrow = !NILP (
BVAR (current_buffer, ctl_arrow)
);
register struct Lisp_Char_Table *dp = window_display_table (win);
register struct Lisp_Char_Table *dp = window_display_table (win);
-
int
selective
- = (INTEGERP (
current_buffer->selective_display
)
- ? XINT (
current_buffer->selective_display
)
- : !NILP (
current_buffer->selective_display
) ? -1 : 0);
+
EMACS_INT
selective
+ = (INTEGERP (
BVAR (current_buffer, selective_display)
)
+ ? XINT (
BVAR (current_buffer, selective_display)
)
+ : !NILP (
BVAR (current_buffer, selective_display)
) ? -1 : 0);
int selective_rlen
= (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
int selective_rlen
= (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
- ?
XVECTOR_
SIZE (DISP_INVIS_VECTOR (dp)) : 0);
+ ?
A
SIZE (DISP_INVIS_VECTOR (dp)) : 0);
/* The next location where the `invisible' property changes, or an
overlay starts or ends. */
EMACS_INT next_boundary = from;
/* The next location where the `invisible' property changes, or an
overlay starts or ends. */
EMACS_INT next_boundary = from;
@@
-1178,7
+1146,7
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
EMACS_INT next_width_run = from;
Lisp_Object window;
EMACS_INT next_width_run = from;
Lisp_Object window;
- int multibyte = !NILP (
current_buffer->enable_multibyte_characters
);
+ int multibyte = !NILP (
BVAR (current_buffer, enable_multibyte_characters)
);
/* If previous char scanned was a wide character,
this is the column where it ended. Otherwise, this is 0. */
EMACS_INT wide_column_end_hpos = 0;
/* If previous char scanned was a wide character,
this is the column where it ended. Otherwise, this is 0. */
EMACS_INT wide_column_end_hpos = 0;
@@
-1197,8
+1165,8
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
width_run_cache_on_off ();
if (dp == buffer_display_table ())
width_run_cache_on_off ();
if (dp == buffer_display_table ())
- width_table = (VECTORP (
current_buffer->width_table
)
- ? XVECTOR (
current_buffer->width_table
)->contents
+ width_table = (VECTORP (
BVAR (current_buffer, width_table)
)
+ ? XVECTOR (
BVAR (current_buffer, width_table)
)->contents
: 0);
else
/* If the window has its own display table, we can't use the width
: 0);
else
/* If the window has its own display table, we can't use the width
@@
-1211,7
+1179,7
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
/* Negative width means use all available text columns. */
if (width < 0)
{
/* Negative width means use all available text columns. */
if (width < 0)
{
- width = window_bo
x_text
_cols (win);
+ width = window_bo
dy
_cols (win);
/* We must make room for continuation marks if we don't have fringes. */
#ifdef HAVE_WINDOW_SYSTEM
if (!FRAME_WINDOW_P (XFRAME (win->frame)))
/* We must make room for continuation marks if we don't have fringes. */
#ifdef HAVE_WINDOW_SYSTEM
if (!FRAME_WINDOW_P (XFRAME (win->frame)))
@@
-1232,7
+1200,7
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
pos_byte = prev_pos_byte = CHAR_TO_BYTE (from);
contin_hpos = 0;
prev_tab_offset = tab_offset;
pos_byte = prev_pos_byte = CHAR_TO_BYTE (from);
contin_hpos = 0;
prev_tab_offset = tab_offset;
-
bzero (&cmp_it
, sizeof cmp_it);
+
memset (&cmp_it, 0
, sizeof cmp_it);
cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil);
cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil);
@@
-1275,9
+1243,9
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
to be changed here. */
{
unsigned char *ovstr;
to be changed here. */
{
unsigned char *ovstr;
-
int
ovlen = overlay_strings (pos, win, &ovstr);
+
EMACS_INT
ovlen = overlay_strings (pos, win, &ovstr);
hpos += ((multibyte && ovlen > 0)
hpos += ((multibyte && ovlen > 0)
- ? strwidth (ovstr, ovlen) : ovlen);
+ ? strwidth (
(char *)
ovstr, ovlen) : ovlen);
}
did_motion = 0;
}
did_motion = 0;
@@
-1364,7
+1332,7
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
}
if (hscroll || truncate
}
if (hscroll || truncate
- || !NILP (
current_buffer->truncate_lines
))
+ || !NILP (
BVAR (current_buffer, truncate_lines)
))
{
/* Truncating: skip to newline, unless we are already past
TO (we need to go back below). */
{
/* Truncating: skip to newline, unless we are already past
TO (we need to go back below). */
@@
-1469,7
+1437,7
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
the text character-by-character. */
if (current_buffer->width_run_cache && pos >= next_width_run)
{
the text character-by-character. */
if (current_buffer->width_run_cache && pos >= next_width_run)
{
-
int
run_end;
+
EMACS_INT
run_end;
int common_width
= region_cache_forward (current_buffer,
current_buffer->width_run_cache,
int common_width
= region_cache_forward (current_buffer,
current_buffer->width_run_cache,
@@
-1480,7
+1448,7
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
want to skip over it for some other reason. */
if (common_width != 0)
{
want to skip over it for some other reason. */
if (common_width != 0)
{
-
int
run_end_hpos;
+
EMACS_INT
run_end_hpos;
/* Don't go past the final buffer posn the user
requested. */
/* Don't go past the final buffer posn the user
requested. */
@@
-1577,7
+1545,7
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
}
if (dp != 0
}
if (dp != 0
- && ! (multibyte &&
BASE_
LEADING_CODE_P (c))
+ && ! (multibyte && LEADING_CODE_P (c))
&& VECTORP (DISP_CHAR_VECTOR (dp, c)))
{
charvec = DISP_CHAR_VECTOR (dp, c);
&& VECTORP (DISP_CHAR_VECTOR (dp, c)))
{
charvec = DISP_CHAR_VECTOR (dp, c);
@@
-1617,8
+1585,7
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
else if (c == '\n')
{
if (selective > 0
else if (c == '\n')
{
if (selective > 0
- && indented_beyond_p (pos, pos_byte,
- (double) selective)) /* iftc */
+ && indented_beyond_p (pos, pos_byte, selective))
{
/* If (pos == to), we don't have to take care of
selective display. */
{
/* If (pos == to), we don't have to take care of
selective display. */
@@
-1634,7
+1601,7
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
}
while (pos < to
&& indented_beyond_p (pos, pos_byte,
}
while (pos < to
&& indented_beyond_p (pos, pos_byte,
- (double) selective)); /* iftc */
+ selective));
/* Allow for the " ..." that is displayed for them. */
if (selective_rlen)
{
/* Allow for the " ..." that is displayed for them. */
if (selective_rlen)
{
@@
-1683,19
+1650,19
@@
compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
hpos = width;
}
}
hpos = width;
}
}
- else if (multibyte &&
BASE_
LEADING_CODE_P (c))
+ else if (multibyte && LEADING_CODE_P (c))
{
/* Start of multi-byte form. */
unsigned char *ptr;
{
/* Start of multi-byte form. */
unsigned char *ptr;
- int
bytes, width, wide_column
;
+ int
mb_bytes, mb_width
;
pos_byte--; /* rewind POS_BYTE */
ptr = BYTE_POS_ADDR (pos_byte);
pos_byte--; /* rewind POS_BYTE */
ptr = BYTE_POS_ADDR (pos_byte);
- MULTIBYTE_BYTES_WIDTH (ptr, dp);
- pos_byte += bytes;
- if (
wide_column
)
- wide_column_end_hpos = hpos +
wide_column
;
- hpos += width;
+ MULTIBYTE_BYTES_WIDTH (ptr, dp
, mb_bytes, mb_width
);
+ pos_byte +=
mb_
bytes;
+ if (
mb_width > 1 && BYTES_BY_CHAR_HEAD (*ptr) == mb_bytes
)
+ wide_column_end_hpos = hpos +
mb_width
;
+ hpos +=
mb_
width;
}
else if (VECTORP (charvec))
++hpos;
}
else if (VECTORP (charvec))
++hpos;
@@
-1775,9
+1742,7
@@
of a certain window, pass the window's starting location as FROM
and the window's upper-left coordinates as FROMPOS.
Pass the buffer's (point-max) as TO, to limit the scan to the end of the
visible section of the buffer, and pass LINE and COL as TOPOS. */)
and the window's upper-left coordinates as FROMPOS.
Pass the buffer's (point-max) as TO, to limit the scan to the end of the
visible section of the buffer, and pass LINE and COL as TOPOS. */)
- (from, frompos, to, topos, width, offsets, window)
- Lisp_Object from, frompos, to, topos;
- Lisp_Object width, offsets, window;
+ (Lisp_Object from, Lisp_Object frompos, Lisp_Object to, Lisp_Object topos, Lisp_Object width, Lisp_Object offsets, Lisp_Object window)
{
struct window *w;
Lisp_Object bufpos, hpos, vpos, prevhpos;
{
struct window *w;
Lisp_Object bufpos, hpos, vpos, prevhpos;
@@
-1827,7
+1792,7
@@
visible section of the buffer, and pass LINE and COL as TOPOS. */)
? window_internal_height (w)
: XINT (XCDR (topos))),
(NILP (topos)
? window_internal_height (w)
: XINT (XCDR (topos))),
(NILP (topos)
- ? (window_bo
x_text
_cols (w)
+ ? (window_bo
dy
_cols (w)
- (
#ifdef HAVE_WINDOW_SYSTEM
FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 :
- (
#ifdef HAVE_WINDOW_SYSTEM
FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 :
@@
-1853,12
+1818,10
@@
visible section of the buffer, and pass LINE and COL as TOPOS. */)
\f
/* Fvertical_motion and vmotion */
\f
/* Fvertical_motion and vmotion */
-struct position val_vmotion;
+st
atic st
ruct position val_vmotion;
struct position *
struct position *
-vmotion (from, vtarget, w)
- register EMACS_INT from, vtarget;
- struct window *w;
+vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
{
EMACS_INT hscroll = XINT (w->hscroll);
struct position pos;
{
EMACS_INT hscroll = XINT (w->hscroll);
struct position pos;
@@
-1868,10
+1831,10
@@
vmotion (from, vtarget, w)
register EMACS_INT first;
EMACS_INT from_byte;
EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0;
register EMACS_INT first;
EMACS_INT from_byte;
EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0;
-
int
selective
- = (INTEGERP (
current_buffer->selective_display
)
- ? XINT (
current_buffer->selective_display
)
- : !NILP (
current_buffer->selective_display
) ? -1 : 0);
+
EMACS_INT
selective
+ = (INTEGERP (
BVAR (current_buffer, selective_display)
)
+ ? XINT (
BVAR (current_buffer, selective_display)
)
+ : !NILP (
BVAR (current_buffer, selective_display)
) ? -1 : 0);
Lisp_Object window;
EMACS_INT start_hpos = 0;
int did_motion;
Lisp_Object window;
EMACS_INT start_hpos = 0;
int did_motion;
@@
-1903,7
+1866,7
@@
vmotion (from, vtarget, w)
&& ((selective > 0
&& indented_beyond_p (prevline,
CHAR_TO_BYTE (prevline),
&& ((selective > 0
&& indented_beyond_p (prevline,
CHAR_TO_BYTE (prevline),
- (double) selective)) /* iftc */
+ selective))
/* Watch out for newlines with `invisible' property.
When moving upward, check the newline before. */
|| (propval = Fget_char_property (make_number (prevline - 1),
/* Watch out for newlines with `invisible' property.
When moving upward, check the newline before. */
|| (propval = Fget_char_property (make_number (prevline - 1),
@@
-1960,7
+1923,7
@@
vmotion (from, vtarget, w)
&& ((selective > 0
&& indented_beyond_p (prevline,
CHAR_TO_BYTE (prevline),
&& ((selective > 0
&& indented_beyond_p (prevline,
CHAR_TO_BYTE (prevline),
- (double) selective)) /* iftc */
+ selective))
/* Watch out for newlines with `invisible' property.
When moving downward, check the newline after. */
|| (propval = Fget_char_property (make_number (prevline),
/* Watch out for newlines with `invisible' property.
When moving downward, check the newline after. */
|| (propval = Fget_char_property (make_number (prevline),
@@
-2021,8
+1984,7
@@
regardless of which buffer is displayed in WINDOW.
This is consistent with other cursor motion functions
and makes it possible to use `vertical-motion' in any buffer,
whether or not it is currently displayed in some window. */)
This is consistent with other cursor motion functions
and makes it possible to use `vertical-motion' in any buffer,
whether or not it is currently displayed in some window. */)
- (lines, window)
- Lisp_Object lines, window;
+ (Lisp_Object lines, Lisp_Object window)
{
struct it it;
struct text_pos pt;
{
struct it it;
struct text_pos pt;
@@
-2030,7
+1992,7
@@
whether or not it is currently displayed in some window. */)
Lisp_Object old_buffer;
struct gcpro gcpro1;
Lisp_Object lcols = Qnil;
Lisp_Object old_buffer;
struct gcpro gcpro1;
Lisp_Object lcols = Qnil;
- double cols;
+ double cols
IF_LINT (= 0)
;
/* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */
if (CONSP (lines) && (NUMBERP (XCAR (lines))))
/* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */
if (CONSP (lines) && (NUMBERP (XCAR (lines))))
@@
-2064,7
+2026,8
@@
whether or not it is currently displayed in some window. */)
}
else
{
}
else
{
- int it_start, first_x, it_overshoot_expected;
+ EMACS_INT it_start;
+ int first_x, it_overshoot_expected IF_LINT (= 0);
SET_TEXT_POS (pt, PT, PT_BYTE);
start_display (&it, w, pt);
SET_TEXT_POS (pt, PT, PT_BYTE);
start_display (&it, w, pt);
@@
-2078,7
+2041,7
@@
whether or not it is currently displayed in some window. */)
it_overshoot_expected = 1;
else if (it.method == GET_FROM_STRING)
{
it_overshoot_expected = 1;
else if (it.method == GET_FROM_STRING)
{
- const char *s = SDATA (it.string);
+ const char *s = S
S
DATA (it.string);
const char *e = s + SBYTES (it.string);
while (s < e && *s != '\n')
++s;
const char *e = s + SBYTES (it.string);
while (s < e && *s != '\n')
++s;
@@
-2107,7
+2070,7
@@
whether or not it is currently displayed in some window. */)
/* Do this even if LINES is 0, so that we move back to the
beginning of the current line as we ought. */
if (XINT (lines) == 0 || IT_CHARPOS (it) > 0)
/* Do this even if LINES is 0, so that we move back to the
beginning of the current line as we ought. */
if (XINT (lines) == 0 || IT_CHARPOS (it) > 0)
- move_it_by_lines (&it, XINT (lines)
, 0
);
+ move_it_by_lines (&it, XINT (lines));
}
else
{
}
else
{
@@
-2125,9
+2088,9
@@
whether or not it is currently displayed in some window. */)
|| (it_overshoot_expected < 0
&& it.method == GET_FROM_BUFFER
&& it.c == '\n'))
|| (it_overshoot_expected < 0
&& it.method == GET_FROM_BUFFER
&& it.c == '\n'))
- move_it_by_lines (&it, -1
, 0
);
+ move_it_by_lines (&it, -1);
it.vpos = 0;
it.vpos = 0;
- move_it_by_lines (&it, XINT (lines)
, 0
);
+ move_it_by_lines (&it, XINT (lines));
}
else
{
}
else
{
@@
-2140,15
+2103,15
@@
whether or not it is currently displayed in some window. */)
while (IT_CHARPOS (it) <= it_start)
{
it.vpos = 0;
while (IT_CHARPOS (it) <= it_start)
{
it.vpos = 0;
- move_it_by_lines (&it, 1
, 0
);
+ move_it_by_lines (&it, 1);
}
if (XINT (lines) > 1)
}
if (XINT (lines) > 1)
- move_it_by_lines (&it, XINT (lines) - 1
, 0
);
+ move_it_by_lines (&it, XINT (lines) - 1);
}
else
{
it.vpos = 0;
}
else
{
it.vpos = 0;
- move_it_by_lines (&it, XINT (lines)
, 0
);
+ move_it_by_lines (&it, XINT (lines));
}
}
}
}
}
}
@@
-2183,9
+2146,9
@@
whether or not it is currently displayed in some window. */)
/* File's initialization. */
void
/* File's initialization. */
void
-syms_of_indent ()
+syms_of_indent (
void
)
{
{
- DEFVAR_BOOL ("indent-tabs-mode",
&
indent_tabs_mode,
+ DEFVAR_BOOL ("indent-tabs-mode", indent_tabs_mode,
doc: /* *Indentation can insert tabs if this is non-nil. */);
indent_tabs_mode = 1;
doc: /* *Indentation can insert tabs if this is non-nil. */);
indent_tabs_mode = 1;
@@
-2196,6
+2159,3
@@
syms_of_indent ()
defsubr (&Svertical_motion);
defsubr (&Scompute_motion);
}
defsubr (&Svertical_motion);
defsubr (&Scompute_motion);
}
-
-/* arch-tag: 9adfea44-71f7-4988-8ee3-96da15c502cc
- (do not change this comment) */