summaryrefslogtreecommitdiff
path: root/src/indent.c
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-05-16 14:29:27 +0000
committerGerd Moellmann <gerd@gnu.org>2000-05-16 14:29:27 +0000
commit154a424ac4967c05cdd66a440aafb62f561f2627 (patch)
tree7d9dfbe6b040e2dffe4c775572aa1cbfeef50cf7 /src/indent.c
parent9ab8560dc21300b8d7fe5ce9aee37c2244f4642e (diff)
downloademacs-154a424ac4967c05cdd66a440aafb62f561f2627.tar.gz
(Fmove_to_column): When ending within a tab, insert
spaces first so that markers at the end of the tab get adjusted.
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/indent.c b/src/indent.c
index 486589a0464..0de5bf51b1d 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -944,14 +944,21 @@ The return value is the current column.")
and scan through it again. */
if (!NILP (force) && col > goal && c == '\t' && prev_col < goal)
{
- int old_point, old_point_byte;
-
- del_range (PT - 1, PT);
- Findent_to (make_number (goal), Qnil);
- old_point = PT;
- old_point_byte = PT_BYTE;
+ int goal_pt, goal_pt_byte;
+
+ /* Insert spaces in front of the tab to reach GOAL. Do this
+ first so that a marker at the end of the tab gets
+ adjusted. */
+ SET_PT_BOTH (PT - 1, PT_BYTE - 1);
+ Finsert_char (make_number (' '), make_number (goal - prev_col), Qt);
+
+ /* Now delete the tab, and indent to COL. */
+ del_range (PT, PT + 1);
+ goal_pt = PT;
+ goal_pt_byte = PT_BYTE;
Findent_to (make_number (col), Qnil);
- SET_PT_BOTH (old_point, old_point_byte);
+ SET_PT_BOTH (goal_pt, goal_pt_byte);
+
/* Set the last_known... vars consistently. */
col = goal;
}