comparison src/indent.c @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 538048ae2ab8
children 3d6bfa290dbd
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
215 however, ^M is treated as end of line when `selective-display' is t. 215 however, ^M is treated as end of line when `selective-display' is t.
216 If BUFFER is nil, the current buffer is assumed. 216 If BUFFER is nil, the current buffer is assumed.
217 */ 217 */
218 (buffer)) 218 (buffer))
219 { 219 {
220 return (make_int (current_column (decode_buffer (buffer, 0)))); 220 return make_int (current_column (decode_buffer (buffer, 0)));
221 } 221 }
222 222
223 223
224 DEFUN ("indent-to", Findent_to, 1, 3, "NIndent to column: ", /* 224 DEFUN ("indent-to", Findent_to, 1, 3, "NIndent to column: ", /*
225 Indent from point with tabs and spaces until COLUMN is reached. 225 Indent from point with tabs and spaces until COLUMN is reached.
285 285
286 /* Not in FSF: */ 286 /* Not in FSF: */
287 if (opoint > 0) 287 if (opoint > 0)
288 BUF_SET_PT (buf, opoint); 288 BUF_SET_PT (buf, opoint);
289 289
290 return (make_int (mincol)); 290 return make_int (mincol);
291 } 291 }
292 292
293 int 293 int
294 bi_spaces_at_point (struct buffer *b, Bytind bi_pos) 294 bi_spaces_at_point (struct buffer *b, Bytind bi_pos)
295 { 295 {
356 int goal; 356 int goal;
357 Bufpos end; 357 Bufpos end;
358 int tab_width = XINT (buf->tab_width); 358 int tab_width = XINT (buf->tab_width);
359 359
360 int prev_col = 0; 360 int prev_col = 0;
361 Emchar c; 361 Emchar c = 0;
362 362
363 XSETBUFFER (buffer, buf); 363 XSETBUFFER (buffer, buf);
364 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 364 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
365 CHECK_NATNUM (column); 365 CHECK_NATNUM (column);
366 goal = XINT (column); 366 goal = XINT (column);
574 cur_line--; 574 cur_line--;
575 ret_pt = Dynarr_atp (w->line_start_cache, cur_line + elt)->start; 575 ret_pt = Dynarr_atp (w->line_start_cache, cur_line + elt)->start;
576 } 576 }
577 577
578 if (ret_vpos) *ret_vpos = cur_line; 578 if (ret_vpos) *ret_vpos = cur_line;
579 return (ret_pt); 579 return ret_pt;
580 } 580 }
581 else if (vtarget < 0) 581 else if (vtarget < 0)
582 { 582 {
583 if (elt < -vtarget) 583 if (elt < -vtarget)
584 { 584 {
585 if (ret_vpos) *ret_vpos = -elt; 585 if (ret_vpos) *ret_vpos = -elt;
586 /* #### This should be BUF_BEGV (b), right? */ 586 /* #### This should be BUF_BEGV (b), right? */
587 return (Dynarr_atp (w->line_start_cache, 0)->start); 587 return Dynarr_atp (w->line_start_cache, 0)->start;
588 } 588 }
589 else 589 else
590 { 590 {
591 if (ret_vpos) *ret_vpos = vtarget; 591 if (ret_vpos) *ret_vpos = vtarget;
592 return (Dynarr_atp (w->line_start_cache, elt + vtarget)->start); 592 return Dynarr_atp (w->line_start_cache, elt + vtarget)->start;
593 } 593 }
594 } 594 }
595 else 595 else
596 { 596 {
597 /* No vertical motion requested so we just return the position 597 /* No vertical motion requested so we just return the position
598 of the beginning of the current line. */ 598 of the beginning of the current line. */
599 if (ret_vpos) *ret_vpos = 0; 599 if (ret_vpos) *ret_vpos = 0;
600 600
601 return (Dynarr_atp (w->line_start_cache, elt)->start); 601 return Dynarr_atp (w->line_start_cache, elt)->start;
602 } 602 }
603 603
604 RETURN_NOT_REACHED(0) /* shut up compiler */ 604 RETURN_NOT_REACHED(0) /* shut up compiler */
605 } 605 }
606 606