last_known_column_point = 0;
}
+/* Return a non-outlandish value for the tab width. */
+
+static int
+sane_tab_width (void)
+{
+ EMACS_INT n = XFASTINT (BVAR (current_buffer, tab_width));
+ return 0 < n && n <= 1000 ? n : 8;
+}
+
EMACS_INT
current_column (void)
{
register int tab_seen;
EMACS_INT post_tab;
register int c;
- register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width));
+ int tab_width = sane_tab_width ();
int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = buffer_display_table ();
else
stop = GAP_END_ADDR;
- if (tab_width <= 0 || tab_width > 1000)
- tab_width = 8;
-
col = 0, tab_seen = 0, post_tab = 0;
while (1)
static void
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
{
- register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width));
+ int tab_width = sane_tab_width ();
register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = buffer_display_table ();
int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
w = ! NILP (window) ? XWINDOW (window) : NULL;
- if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
memset (&cmp_it, 0, sizeof cmp_it);
cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
register int tab_seen;
int post_tab;
register int c;
- register int tab_width = XINT (current_buffer->tab_width);
+ int tab_width = sane_tab_width ();
int ctl_arrow = !NILP (current_buffer->ctl_arrow);
register struct Lisp_Char_Table *dp = buffer_display_table ();
int b, e;
going backwards from point. */
stop = SDATA (string) + b;
- if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
-
col = 0, tab_seen = 0, post_tab = 0;
while (1)
{
EMACS_INT mincol;
register EMACS_INT fromcol;
- register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width));
+ int tab_width = sane_tab_width ();
CHECK_NUMBER (column);
if (NILP (minimum))
if (fromcol == mincol)
return make_number (mincol);
- if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
-
if (indent_tabs_mode)
{
Lisp_Object n;
position_indentation (register int pos_byte)
{
register EMACS_INT column = 0;
- register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width));
+ int tab_width = sane_tab_width ();
register unsigned char *p;
register unsigned char *stop;
unsigned char *start;
EMACS_INT next_boundary_byte = pos_byte;
EMACS_INT ceiling = next_boundary_byte;
- if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
-
p = BYTE_POS_ADDR (pos_byte);
/* STOP records the value of P at which we will need
to think about the gap, or about invisible text,
register EMACS_INT pos;
EMACS_INT pos_byte;
register int c = 0;
- register EMACS_INT tab_width = XFASTINT (BVAR (current_buffer, tab_width));
+ int tab_width = sane_tab_width ();
register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = window_display_table (win);
EMACS_INT selective
run cache, because that's based on the buffer's display table. */
width_table = 0;
- if (tab_width <= 0 || tab_width > 1000)
- tab_width = 8;
-
/* Negative width means use all available text columns. */
if (width < 0)
{