comparison src/indent.c @ 16039:855c8d8ba0f0

Change all references from point to PT.
author Karl Heuer <kwzh@gnu.org>
date Sun, 01 Sep 1996 19:15:05 +0000
parents 6e4665e4f807
children 3cc73a430181
comparison
equal deleted inserted replaced
16038:8cd162ceb1dc 16039:855c8d8ba0f0
281 register int tab_width = XINT (current_buffer->tab_width); 281 register int tab_width = XINT (current_buffer->tab_width);
282 int ctl_arrow = !NILP (current_buffer->ctl_arrow); 282 int ctl_arrow = !NILP (current_buffer->ctl_arrow);
283 register struct Lisp_Char_Table *dp = buffer_display_table (); 283 register struct Lisp_Char_Table *dp = buffer_display_table ();
284 int stopchar; 284 int stopchar;
285 285
286 if (point == last_known_column_point 286 if (PT == last_known_column_point
287 && MODIFF == last_known_column_modified) 287 && MODIFF == last_known_column_modified)
288 return last_known_column; 288 return last_known_column;
289 289
290 /* If the buffer has overlays or text properties, 290 /* If the buffer has overlays or text properties,
291 use a more general algorithm. */ 291 use a more general algorithm. */
292 if (BUF_INTERVALS (current_buffer) 292 if (BUF_INTERVALS (current_buffer)
293 || !NILP (current_buffer->overlays_before) 293 || !NILP (current_buffer->overlays_before)
294 || !NILP (current_buffer->overlays_after)) 294 || !NILP (current_buffer->overlays_after))
295 return current_column_1 (point); 295 return current_column_1 (PT);
296 296
297 /* Scan backwards from point to the previous newline, 297 /* Scan backwards from point to the previous newline,
298 counting width. Tab characters are the only complicated case. */ 298 counting width. Tab characters are the only complicated case. */
299 299
300 /* Make a pointer for decrementing through the chars before point. */ 300 /* Make a pointer for decrementing through the chars before point. */
301 ptr = &FETCH_CHAR (point - 1) + 1; 301 ptr = &FETCH_CHAR (PT - 1) + 1;
302 /* Make a pointer to where consecutive chars leave off, 302 /* Make a pointer to where consecutive chars leave off,
303 going backwards from point. */ 303 going backwards from point. */
304 if (point == BEGV) 304 if (PT == BEGV)
305 stop = ptr; 305 stop = ptr;
306 else if (point <= GPT || BEGV > GPT) 306 else if (PT <= GPT || BEGV > GPT)
307 stop = BEGV_ADDR; 307 stop = BEGV_ADDR;
308 else 308 else
309 stop = GAP_END_ADDR; 309 stop = GAP_END_ADDR;
310 310
311 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 311 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
354 col = ((col + tab_width) / tab_width) * tab_width; 354 col = ((col + tab_width) / tab_width) * tab_width;
355 col += post_tab; 355 col += post_tab;
356 } 356 }
357 357
358 last_known_column = col; 358 last_known_column = col;
359 last_known_column_point = point; 359 last_known_column_point = PT;
360 last_known_column_modified = MODIFF; 360 last_known_column_modified = MODIFF;
361 361
362 return col; 362 return col;
363 } 363 }
364 364
423 col++; 423 col++;
424 } 424 }
425 endloop: 425 endloop:
426 426
427 last_known_column = col; 427 last_known_column = col;
428 last_known_column_point = point; 428 last_known_column_point = PT;
429 last_known_column_modified = MODIFF; 429 last_known_column_modified = MODIFF;
430 430
431 return col; 431 return col;
432 } 432 }
433 433
548 548
549 XSETFASTINT (column, mincol - fromcol); 549 XSETFASTINT (column, mincol - fromcol);
550 Finsert_char (make_number (' '), column, Qt); 550 Finsert_char (make_number (' '), column, Qt);
551 551
552 last_known_column = mincol; 552 last_known_column = mincol;
553 last_known_column_point = point; 553 last_known_column_point = PT;
554 last_known_column_modified = MODIFF; 554 last_known_column_modified = MODIFF;
555 555
556 XSETINT (column, mincol); 556 XSETINT (column, mincol);
557 return column; 557 return column;
558 } 558 }
565 following any initial whitespace.") 565 following any initial whitespace.")
566 () 566 ()
567 { 567 {
568 Lisp_Object val; 568 Lisp_Object val;
569 569
570 XSETFASTINT (val, position_indentation (find_next_newline (point, -1))); 570 XSETFASTINT (val, position_indentation (find_next_newline (PT, -1)));
571 return val; 571 return val;
572 } 572 }
573 573
574 position_indentation (pos) 574 position_indentation (pos)
575 register int pos; 575 register int pos;
678 678
679 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 679 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
680 CHECK_NATNUM (column, 0); 680 CHECK_NATNUM (column, 0);
681 goal = XINT (column); 681 goal = XINT (column);
682 682
683 pos = point; 683 pos = PT;
684 end = ZV; 684 end = ZV;
685 next_boundary = pos; 685 next_boundary = pos;
686 686
687 /* If we're starting past the desired column, 687 /* If we're starting past the desired column,
688 back up to beginning of line and scan from there. */ 688 back up to beginning of line and scan from there. */
741 and scan through it again. */ 741 and scan through it again. */
742 if (!NILP (force) && col > goal && c == '\t' && prev_col < goal) 742 if (!NILP (force) && col > goal && c == '\t' && prev_col < goal)
743 { 743 {
744 int old_point; 744 int old_point;
745 745
746 del_range (point - 1, point); 746 del_range (PT - 1, PT);
747 Findent_to (make_number (goal), Qnil); 747 Findent_to (make_number (goal), Qnil);
748 old_point = point; 748 old_point = PT;
749 Findent_to (make_number (col), Qnil); 749 Findent_to (make_number (col), Qnil);
750 SET_PT (old_point); 750 SET_PT (old_point);
751 /* Set the last_known... vars consistently. */ 751 /* Set the last_known... vars consistently. */
752 col = goal; 752 col = goal;
753 } 753 }
755 /* If line ends prematurely, add space to the end. */ 755 /* If line ends prematurely, add space to the end. */
756 if (col < goal && !NILP (force)) 756 if (col < goal && !NILP (force))
757 Findent_to (make_number (col = goal), Qnil); 757 Findent_to (make_number (col = goal), Qnil);
758 758
759 last_known_column = col; 759 last_known_column = col;
760 last_known_column_point = point; 760 last_known_column_point = PT;
761 last_known_column_modified = MODIFF; 761 last_known_column_modified = MODIFF;
762 762
763 XSETFASTINT (val, col); 763 XSETFASTINT (val, col);
764 return val; 764 return val;
765 } 765 }
1407 if (! NILP (window)) 1407 if (! NILP (window))
1408 CHECK_WINDOW (window, 0); 1408 CHECK_WINDOW (window, 0);
1409 else 1409 else
1410 window = selected_window; 1410 window = selected_window;
1411 1411
1412 pos = *vmotion (point, (int) XINT (lines), XWINDOW (window)); 1412 pos = *vmotion (PT, (int) XINT (lines), XWINDOW (window));
1413 1413
1414 SET_PT (pos.bufpos); 1414 SET_PT (pos.bufpos);
1415 return make_number (pos.vpos); 1415 return make_number (pos.vpos);
1416 } 1416 }
1417 1417