mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Merge: current_column: Now returns EMACS_INT, fixing some iftc
that was introduced in the 2002-06-02 change "temporarily"; see <http://lists.gnu.org/archive/html/emacs-devel/2002-06/msg00039.html>. * bytecode.c (Fbyte_code): Don't cast current_column () to int. * cmds.c (internal_self_insert): Likewise. * indent.c (Fcurrent_column): Likewise. * keymap.c (describe_command): Likewise. * minibuf.c (read_minibuf): Likewise. * indent.c (Fcurrent_indentation): Don't cast position_indentation () to int. * xdisp.c (redisplay_internal, redisplay_window, decode_mode_spec): Likewise. * cmds.c (internal_self_insert): Declare locals to be EMACS_INT, not int or double, if they might contain a column number. * indent.c (current_column, Findent_to, indented_beyond_p): (compute_motion, vmotion): Likewise. * keymap.c (describe_command): Likewise. * xdisp.c (pint2str): Likewise. * indent.c (last_known_column): Now EMACS_INT, not int. * minibuf.c (minibuf_prompt_width): Likewise. * indent.c (current_column, current_column_1, position_indentation): Return EMACS_INT, not double. * lisp.h (current_column): Likewise. * indent.c (indented_beyond_p): Last arg is now EMACS_INT, not double. All callers changed. * lisp.h (indented_beyond_p): Likewise. * minibuf.c (minibuf_prompt, minibuf_prompt_width): Move here from xdisp.c, and make static, since these are used only here. * window.h, xdisp.c (minibuf_prompt, minibuf_prompt_width): Remove decls. * xdisp.c (redisplay_window): Reindent to match Emacs style.
This commit is contained in:
commit
5f349a895b
9 changed files with 87 additions and 66 deletions
|
|
@ -1,6 +1,39 @@
|
|||
2011-03-06 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
current_column: Now returns EMACS_INT, fixing some iftc
|
||||
that was introduced in the 2002-06-02 change "temporarily"; see
|
||||
<http://lists.gnu.org/archive/html/emacs-devel/2002-06/msg00039.html>.
|
||||
* bytecode.c (Fbyte_code): Don't cast current_column () to int.
|
||||
* cmds.c (internal_self_insert): Likewise.
|
||||
* indent.c (Fcurrent_column): Likewise.
|
||||
* keymap.c (describe_command): Likewise.
|
||||
* minibuf.c (read_minibuf): Likewise.
|
||||
* indent.c (Fcurrent_indentation): Don't cast position_indentation ()
|
||||
to int.
|
||||
* xdisp.c (redisplay_internal, redisplay_window, decode_mode_spec):
|
||||
Likewise.
|
||||
* cmds.c (internal_self_insert): Declare locals to be EMACS_INT,
|
||||
not int or double, if they might contain a column number.
|
||||
* indent.c (current_column, Findent_to, indented_beyond_p):
|
||||
(compute_motion, vmotion): Likewise.
|
||||
* keymap.c (describe_command): Likewise.
|
||||
* xdisp.c (pint2str): Likewise.
|
||||
* indent.c (last_known_column): Now EMACS_INT, not int.
|
||||
* minibuf.c (minibuf_prompt_width): Likewise.
|
||||
* indent.c (current_column, current_column_1, position_indentation):
|
||||
Return EMACS_INT, not double.
|
||||
* lisp.h (current_column): Likewise.
|
||||
* indent.c (indented_beyond_p): Last arg is now EMACS_INT, not double.
|
||||
All callers changed.
|
||||
* lisp.h (indented_beyond_p): Likewise.
|
||||
|
||||
* minibuf.c (minibuf_prompt, minibuf_prompt_width): Move here
|
||||
from xdisp.c, and make static, since these are used only here.
|
||||
* window.h, xdisp.c (minibuf_prompt, minibuf_prompt_width):
|
||||
Remove decls.
|
||||
|
||||
* cmds.c (internal_self_insert): Reindent to match Emacs style.
|
||||
* xdisp.c (redisplay_window): Likewise.
|
||||
|
||||
* xdisp.c: Rename or move local decls to avoid shadowing.
|
||||
(init_iterator, handle_fontified_prop, handle_single_display_spec):
|
||||
|
|
|
|||
|
|
@ -1323,7 +1323,7 @@ If the third argument is incorrect, Emacs may crash. */)
|
|||
{
|
||||
Lisp_Object v1;
|
||||
BEFORE_POTENTIAL_GC ();
|
||||
XSETFASTINT (v1, (int) current_column ()); /* iftc */
|
||||
XSETFASTINT (v1, current_column ());
|
||||
AFTER_POTENTIAL_GC ();
|
||||
PUSH (v1);
|
||||
break;
|
||||
|
|
|
|||
13
src/cmds.c
13
src/cmds.c
|
|
@ -381,19 +381,22 @@ internal_self_insert (int c, EMACS_INT n)
|
|||
{
|
||||
EMACS_INT pos = PT;
|
||||
EMACS_INT pos_byte = PT_BYTE;
|
||||
|
||||
/* FIXME: Check for integer overflow when calculating
|
||||
target_clm and actual_clm. */
|
||||
|
||||
/* Column the cursor should be placed at after this insertion.
|
||||
The correct value should be calculated only when necessary. */
|
||||
int target_clm = ((int) current_column () /* iftc */
|
||||
+ n * (int) XINT (Fchar_width (make_number (c))));
|
||||
EMACS_INT target_clm = (current_column ()
|
||||
+ n * XINT (Fchar_width (make_number (c))));
|
||||
|
||||
/* The actual cursor position after the trial of moving
|
||||
to column TARGET_CLM. It is greater than TARGET_CLM
|
||||
if the TARGET_CLM is middle of multi-column
|
||||
character. In that case, the new point is set after
|
||||
that character. */
|
||||
int actual_clm
|
||||
= (int) XFASTINT (Fmove_to_column (make_number (target_clm),
|
||||
Qnil));
|
||||
EMACS_INT actual_clm
|
||||
= XFASTINT (Fmove_to_column (make_number (target_clm), Qnil));
|
||||
|
||||
chars_to_delete = PT - pos;
|
||||
|
||||
|
|
|
|||
49
src/indent.c
49
src/indent.c
|
|
@ -45,7 +45,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
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. */
|
||||
|
||||
|
|
@ -55,8 +55,8 @@ EMACS_INT last_known_column_point;
|
|||
|
||||
static int last_known_column_modified;
|
||||
|
||||
static double current_column_1 (void);
|
||||
static double position_indentation (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. */
|
||||
|
|
@ -309,7 +309,7 @@ Text that has an invisible property is considered as having width 0, unless
|
|||
(void)
|
||||
{
|
||||
Lisp_Object temp;
|
||||
XSETFASTINT (temp, (int) current_column ()); /* iftc */
|
||||
XSETFASTINT (temp, current_column ());
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
|
@ -321,15 +321,15 @@ invalidate_current_column (void)
|
|||
last_known_column_point = 0;
|
||||
}
|
||||
|
||||
double
|
||||
EMACS_INT
|
||||
current_column (void)
|
||||
{
|
||||
register int col;
|
||||
register EMACS_INT col;
|
||||
register unsigned char *ptr, *stop;
|
||||
register int tab_seen;
|
||||
int post_tab;
|
||||
EMACS_INT post_tab;
|
||||
register int c;
|
||||
register int tab_width = XINT (BVAR (current_buffer, tab_width));
|
||||
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 ();
|
||||
|
||||
|
|
@ -705,7 +705,7 @@ 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. */
|
||||
|
||||
static double
|
||||
static EMACS_INT
|
||||
current_column_1 (void)
|
||||
{
|
||||
EMACS_INT col = MOST_POSITIVE_FIXNUM;
|
||||
|
|
@ -807,9 +807,9 @@ even if that goes past COLUMN; by default, MINIMUM is zero.
|
|||
The return value is COLUMN. */)
|
||||
(Lisp_Object column, Lisp_Object minimum)
|
||||
{
|
||||
int mincol;
|
||||
register int fromcol;
|
||||
register int tab_width = XINT (BVAR (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))
|
||||
|
|
@ -849,8 +849,6 @@ The return value is COLUMN. */)
|
|||
}
|
||||
|
||||
|
||||
static double position_indentation (int);
|
||||
|
||||
DEFUN ("current-indentation", Fcurrent_indentation, Scurrent_indentation,
|
||||
0, 0, 0,
|
||||
doc: /* Return the indentation of the current line.
|
||||
|
|
@ -863,12 +861,12 @@ following any initial whitespace. */)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
static double
|
||||
static EMACS_INT
|
||||
position_indentation (register int pos_byte)
|
||||
{
|
||||
register EMACS_INT column = 0;
|
||||
|
|
@ -958,9 +956,9 @@ position_indentation (register int pos_byte)
|
|||
preceding line. */
|
||||
|
||||
int
|
||||
indented_beyond_p (EMACS_INT pos, EMACS_INT pos_byte, double column)
|
||||
indented_beyond_p (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT column)
|
||||
{
|
||||
double val;
|
||||
EMACS_INT val;
|
||||
EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
|
||||
|
||||
SET_PT_BOTH (pos, pos_byte);
|
||||
|
|
@ -969,7 +967,7 @@ indented_beyond_p (EMACS_INT pos, EMACS_INT pos_byte, double column)
|
|||
|
||||
val = position_indentation (PT_BYTE);
|
||||
SET_PT_BOTH (opoint, opoint_byte);
|
||||
return val >= column; /* hmm, float comparison */
|
||||
return val >= column;
|
||||
}
|
||||
|
||||
DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p",
|
||||
|
|
@ -1126,7 +1124,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
|
|||
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);
|
||||
int selective
|
||||
EMACS_INT selective
|
||||
= (INTEGERP (BVAR (current_buffer, selective_display))
|
||||
? XINT (BVAR (current_buffer, selective_display))
|
||||
: !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
|
||||
|
|
@ -1590,8 +1588,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
|
|||
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. */
|
||||
|
|
@ -1607,7 +1604,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
|
|||
}
|
||||
while (pos < to
|
||||
&& indented_beyond_p (pos, pos_byte,
|
||||
(double) selective)); /* iftc */
|
||||
selective));
|
||||
/* Allow for the " ..." that is displayed for them. */
|
||||
if (selective_rlen)
|
||||
{
|
||||
|
|
@ -1837,7 +1834,7 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
|
|||
register EMACS_INT first;
|
||||
EMACS_INT from_byte;
|
||||
EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0;
|
||||
int selective
|
||||
EMACS_INT selective
|
||||
= (INTEGERP (BVAR (current_buffer, selective_display))
|
||||
? XINT (BVAR (current_buffer, selective_display))
|
||||
: !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
|
||||
|
|
@ -1872,7 +1869,7 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
|
|||
&& ((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),
|
||||
|
|
@ -1929,7 +1926,7 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
|
|||
&& ((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),
|
||||
|
|
|
|||
|
|
@ -3219,7 +3219,7 @@ static void
|
|||
describe_command (Lisp_Object definition, Lisp_Object args)
|
||||
{
|
||||
register Lisp_Object tem1;
|
||||
int column = (int) current_column (); /* iftc */
|
||||
EMACS_INT column = current_column ();
|
||||
int description_column;
|
||||
|
||||
/* If column 16 is no good, go to col 32;
|
||||
|
|
|
|||
|
|
@ -3145,9 +3145,9 @@ extern char *push_key_description (unsigned int, char *, int);
|
|||
EXFUN (Fvertical_motion, 2);
|
||||
EXFUN (Findent_to, 2);
|
||||
EXFUN (Fmove_to_column, 2);
|
||||
extern double current_column (void);
|
||||
extern EMACS_INT current_column (void);
|
||||
extern void invalidate_current_column (void);
|
||||
extern int indented_beyond_p (EMACS_INT, EMACS_INT, double);
|
||||
extern int indented_beyond_p (EMACS_INT, EMACS_INT, EMACS_INT);
|
||||
extern void syms_of_indent (void);
|
||||
|
||||
/* Defined in frame.c */
|
||||
|
|
|
|||
|
|
@ -82,6 +82,15 @@ Lisp_Object Qcase_fold_search;
|
|||
|
||||
Lisp_Object Qread_expression_history;
|
||||
|
||||
/* Prompt to display in front of the mini-buffer contents. */
|
||||
|
||||
static Lisp_Object minibuf_prompt;
|
||||
|
||||
/* Width of current mini-buffer prompt. Only set after display_line
|
||||
of the line that contains the prompt. */
|
||||
|
||||
static EMACS_INT minibuf_prompt_width;
|
||||
|
||||
|
||||
/* Put minibuf on currently selected frame's minibuffer.
|
||||
We do this whenever the user starts a new minibuffer
|
||||
|
|
@ -623,7 +632,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
|
|||
unbind_to (count1, Qnil);
|
||||
}
|
||||
|
||||
minibuf_prompt_width = (int) current_column (); /* iftc */
|
||||
minibuf_prompt_width = current_column ();
|
||||
|
||||
/* Put in the initial input. */
|
||||
if (!NILP (initial))
|
||||
|
|
|
|||
|
|
@ -788,14 +788,6 @@ void run_window_configuration_change_hook (struct frame *f);
|
|||
void set_window_buffer (Lisp_Object window, Lisp_Object buffer,
|
||||
int run_hooks_p, int keep_margins_p);
|
||||
|
||||
/* Prompt to display in front of the minibuffer contents. */
|
||||
|
||||
extern Lisp_Object minibuf_prompt;
|
||||
|
||||
/* The visual width of the above. */
|
||||
|
||||
extern int minibuf_prompt_width;
|
||||
|
||||
/* This is the window where the echo area message was displayed. It
|
||||
is always a minibuffer window, but it may not be the same window
|
||||
currently active as a minibuffer. */
|
||||
|
|
@ -878,4 +870,3 @@ extern void keys_of_window (void);
|
|||
extern int window_box_text_cols (struct window *w);
|
||||
|
||||
#endif /* not WINDOW_H_INCLUDED */
|
||||
|
||||
|
|
|
|||
30
src/xdisp.c
30
src/xdisp.c
|
|
@ -483,15 +483,6 @@ int buffer_shared;
|
|||
|
||||
static Lisp_Object default_invis_vector[3];
|
||||
|
||||
/* Prompt to display in front of the mini-buffer contents. */
|
||||
|
||||
Lisp_Object minibuf_prompt;
|
||||
|
||||
/* Width of current mini-buffer prompt. Only set after display_line
|
||||
of the line that contains the prompt. */
|
||||
|
||||
int minibuf_prompt_width;
|
||||
|
||||
/* This is the window where the echo area message was displayed. It
|
||||
is always a mini-buffer window, but it may not be the same window
|
||||
currently active as a mini-buffer. */
|
||||
|
|
@ -771,7 +762,7 @@ static Lisp_Object get_it_property (struct it *it, Lisp_Object prop);
|
|||
|
||||
static void handle_line_prefix (struct it *);
|
||||
|
||||
static void pint2str (char *, int, int);
|
||||
static void pint2str (char *, int, EMACS_INT);
|
||||
static void pint2hrstr (char *, int, int);
|
||||
static struct text_pos run_window_scroll_functions (Lisp_Object,
|
||||
struct text_pos);
|
||||
|
|
@ -11588,8 +11579,7 @@ redisplay_internal (int preserve_echo_area)
|
|||
&& !(PT == XFASTINT (w->last_point)
|
||||
&& XFASTINT (w->last_modified) >= MODIFF
|
||||
&& XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
|
||||
&& (XFASTINT (w->column_number_displayed)
|
||||
!= (int) current_column ())) /* iftc */
|
||||
&& (XFASTINT (w->column_number_displayed) != current_column ()))
|
||||
w->update_mode_line = Qt;
|
||||
|
||||
unbind_to (count1, Qnil);
|
||||
|
|
@ -13828,8 +13818,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
|
|||
&& !(PT == XFASTINT (w->last_point)
|
||||
&& XFASTINT (w->last_modified) >= MODIFF
|
||||
&& XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
|
||||
&& (XFASTINT (w->column_number_displayed)
|
||||
!= (int) current_column ())) /* iftc */
|
||||
&& (XFASTINT (w->column_number_displayed) != current_column ()))
|
||||
update_mode_line = 1;
|
||||
|
||||
/* Count number of windows showing the selected buffer. An indirect
|
||||
|
|
@ -14337,11 +14326,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
|
|||
|| INTEGERP (w->base_line_pos)
|
||||
/* Column number is displayed and different from the one displayed. */
|
||||
|| (!NILP (w->column_number_displayed)
|
||||
&& (XFASTINT (w->column_number_displayed)
|
||||
!= (int) current_column ()))) /* iftc */
|
||||
/* This means that the window has a mode line. */
|
||||
&& (WINDOW_WANTS_MODELINE_P (w)
|
||||
|| WINDOW_WANTS_HEADER_LINE_P (w)))
|
||||
&& (XFASTINT (w->column_number_displayed) != current_column ())))
|
||||
/* This means that the window has a mode line. */
|
||||
&& (WINDOW_WANTS_MODELINE_P (w)
|
||||
|| WINDOW_WANTS_HEADER_LINE_P (w)))
|
||||
{
|
||||
display_mode_lines (w);
|
||||
|
||||
|
|
@ -18992,7 +18980,7 @@ are the selected window and the WINDOW's buffer). */)
|
|||
the positive integer D to BUF using a minimal field width WIDTH. */
|
||||
|
||||
static void
|
||||
pint2str (register char *buf, register int width, register int d)
|
||||
pint2str (register char *buf, register int width, register EMACS_INT d)
|
||||
{
|
||||
register char *p = buf;
|
||||
|
||||
|
|
@ -19321,7 +19309,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
|
|||
return "";
|
||||
else
|
||||
{
|
||||
int col = (int) current_column (); /* iftc */
|
||||
EMACS_INT col = current_column ();
|
||||
w->column_number_displayed = make_number (col);
|
||||
pint2str (decode_mode_spec_buf, field_width, col);
|
||||
return decode_mode_spec_buf;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue