diff options
Diffstat (limited to 'src/indent.c')
| -rw-r--r-- | src/indent.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/src/indent.c b/src/indent.c index 6aaf86579d7..891b42788ed 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -510,15 +510,10 @@ scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol) | |||
| 510 | register ptrdiff_t col = 0, prev_col = 0; | 510 | register ptrdiff_t col = 0, prev_col = 0; |
| 511 | EMACS_INT goal = goalcol ? *goalcol : MOST_POSITIVE_FIXNUM; | 511 | EMACS_INT goal = goalcol ? *goalcol : MOST_POSITIVE_FIXNUM; |
| 512 | ptrdiff_t end = endpos ? *endpos : PT; | 512 | ptrdiff_t end = endpos ? *endpos : PT; |
| 513 | ptrdiff_t scan, scan_byte; | 513 | ptrdiff_t scan, scan_byte, next_boundary; |
| 514 | ptrdiff_t next_boundary; | 514 | |
| 515 | { | 515 | scan = find_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, NULL, &scan_byte, 1); |
| 516 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; | ||
| 517 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1); | ||
| 518 | scan = PT, scan_byte = PT_BYTE; | ||
| 519 | SET_PT_BOTH (opoint, opoint_byte); | ||
| 520 | next_boundary = scan; | 516 | next_boundary = scan; |
| 521 | } | ||
| 522 | 517 | ||
| 523 | window = Fget_buffer_window (Fcurrent_buffer (), Qnil); | 518 | window = Fget_buffer_window (Fcurrent_buffer (), Qnil); |
| 524 | w = ! NILP (window) ? XWINDOW (window) : NULL; | 519 | w = ! NILP (window) ? XWINDOW (window) : NULL; |
| @@ -835,14 +830,10 @@ This is the horizontal position of the character | |||
| 835 | following any initial whitespace. */) | 830 | following any initial whitespace. */) |
| 836 | (void) | 831 | (void) |
| 837 | { | 832 | { |
| 838 | Lisp_Object val; | 833 | ptrdiff_t posbyte; |
| 839 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; | ||
| 840 | |||
| 841 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1); | ||
| 842 | 834 | ||
| 843 | XSETFASTINT (val, position_indentation (PT_BYTE)); | 835 | find_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, NULL, &posbyte, 1); |
| 844 | SET_PT_BOTH (opoint, opoint_byte); | 836 | return make_number (position_indentation (posbyte)); |
| 845 | return val; | ||
| 846 | } | 837 | } |
| 847 | 838 | ||
| 848 | static ptrdiff_t | 839 | static ptrdiff_t |
| @@ -935,16 +926,13 @@ position_indentation (ptrdiff_t pos_byte) | |||
| 935 | bool | 926 | bool |
| 936 | indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column) | 927 | indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column) |
| 937 | { | 928 | { |
| 938 | ptrdiff_t val; | 929 | while (pos > BEGV && FETCH_BYTE (pos_byte) == '\n') |
| 939 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; | 930 | { |
| 940 | 931 | DEC_BOTH (pos, pos_byte); | |
| 941 | SET_PT_BOTH (pos, pos_byte); | 932 | pos = find_newline (pos, pos_byte, BEGV, BEGV_BYTE, |
| 942 | while (PT > BEGV && FETCH_BYTE (PT_BYTE) == '\n') | 933 | -1, NULL, &pos_byte, 0); |
| 943 | scan_newline (PT - 1, PT_BYTE - 1, BEGV, BEGV_BYTE, -1, 0); | 934 | } |
| 944 | 935 | return position_indentation (pos_byte) >= column; | |
| 945 | val = position_indentation (PT_BYTE); | ||
| 946 | SET_PT_BOTH (opoint, opoint_byte); | ||
| 947 | return val >= column; | ||
| 948 | } | 936 | } |
| 949 | 937 | ||
| 950 | DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, | 938 | DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, |