[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r103560: Merge: current_column: Now r
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r103560: Merge: current_column: Now returns EMACS_INT, fixing some iftc |
Date: |
Sun, 06 Mar 2011 02:53:51 -0800 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 103560 [merge]
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2011-03-06 02:53:51 -0800
message:
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.
modified:
src/ChangeLog
src/bytecode.c
src/cmds.c
src/indent.c
src/keymap.c
src/lisp.h
src/minibuf.c
src/window.h
src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2011-03-06 09:00:53 +0000
+++ b/src/ChangeLog 2011-03-06 10:53:51 +0000
@@ -1,6 +1,39 @@
2011-03-06 Paul Eggert <address@hidden>
+ 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):
=== modified file 'src/bytecode.c'
--- a/src/bytecode.c 2011-02-18 02:07:36 +0000
+++ b/src/bytecode.c 2011-03-06 10:27:06 +0000
@@ -1323,7 +1323,7 @@
{
Lisp_Object v1;
BEFORE_POTENTIAL_GC ();
- XSETFASTINT (v1, (int) current_column ()); /* iftc */
+ XSETFASTINT (v1, current_column ());
AFTER_POTENTIAL_GC ();
PUSH (v1);
break;
=== modified file 'src/cmds.c'
--- a/src/cmds.c 2011-03-06 09:00:53 +0000
+++ b/src/cmds.c 2011-03-06 10:27:06 +0000
@@ -381,19 +381,22 @@
{
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;
=== modified file 'src/indent.c'
--- a/src/indent.c 2011-02-16 15:02:50 +0000
+++ b/src/indent.c 2011-03-06 10:27:06 +0000
@@ -45,7 +45,7 @@
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 @@
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 @@
(void)
{
Lisp_Object temp;
- XSETFASTINT (temp, (int) current_column ()); /* iftc */
+ XSETFASTINT (temp, current_column ());
return temp;
}
@@ -321,15 +321,15 @@
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 @@
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 @@
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 @@
}
-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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
&& ((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 @@
&& ((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),
=== modified file 'src/keymap.c'
--- a/src/keymap.c 2011-02-28 01:07:29 +0000
+++ b/src/keymap.c 2011-03-06 10:27:06 +0000
@@ -3219,7 +3219,7 @@
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;
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2011-02-18 07:44:39 +0000
+++ b/src/lisp.h 2011-03-06 10:27:06 +0000
@@ -3145,9 +3145,9 @@
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 */
=== modified file 'src/minibuf.c'
--- a/src/minibuf.c 2011-02-16 15:02:50 +0000
+++ b/src/minibuf.c 2011-03-06 10:27:06 +0000
@@ -82,6 +82,15 @@
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 @@
unbind_to (count1, Qnil);
}
- minibuf_prompt_width = (int) current_column (); /* iftc */
+ minibuf_prompt_width = current_column ();
/* Put in the initial input. */
if (!NILP (initial))
=== modified file 'src/window.h'
--- a/src/window.h 2011-01-25 04:08:28 +0000
+++ b/src/window.h 2011-03-06 09:52:06 +0000
@@ -788,14 +788,6 @@
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 int window_box_text_cols (struct window *w);
#endif /* not WINDOW_H_INCLUDED */
-
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2011-03-06 08:17:04 +0000
+++ b/src/xdisp.c 2011-03-06 10:27:06 +0000
@@ -483,15 +483,6 @@
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 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 @@
&& !(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 @@
&& !(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 @@
|| 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 @@
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 @@
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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r103560: Merge: current_column: Now returns EMACS_INT, fixing some iftc,
Paul Eggert <=