diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmds.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/cmds.c b/src/cmds.c index 687ba76cb93..3bebb798dd5 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Simple built-in editing commands. | 1 | /* Simple built-in editing commands. |
| 2 | Copyright (C) 1985, 1993, 1994, 1995 Free Software Foundation, Inc. | 2 | Copyright (C) 1985, 93, 94, 95, 1996 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -207,8 +207,38 @@ N was explicitly specified.") | |||
| 207 | (n, killflag) | 207 | (n, killflag) |
| 208 | Lisp_Object n, killflag; | 208 | Lisp_Object n, killflag; |
| 209 | { | 209 | { |
| 210 | Lisp_Object value; | ||
| 211 | int deleted_tab = 0; | ||
| 212 | int i; | ||
| 213 | |||
| 210 | CHECK_NUMBER (n, 0); | 214 | CHECK_NUMBER (n, 0); |
| 211 | return Fdelete_char (make_number (-XINT (n)), killflag); | 215 | |
| 216 | /* See if we are about to delete a tab backwards. */ | ||
| 217 | for (i = 0; i < XINT (n); i++) | ||
| 218 | { | ||
| 219 | if (point - i < BEGV) | ||
| 220 | break; | ||
| 221 | if (FETCH_CHAR (point - i) == '\t') | ||
| 222 | { | ||
| 223 | deleted_tab = 1; | ||
| 224 | break; | ||
| 225 | } | ||
| 226 | } | ||
| 227 | |||
| 228 | value = Fdelete_char (make_number (-XINT (n)), killflag); | ||
| 229 | |||
| 230 | /* In overwrite mode, back over columns while clearing them out, | ||
| 231 | unless at end of line. */ | ||
| 232 | if (XINT (n) > 0 | ||
| 233 | && ! NILP (current_buffer->overwrite_mode) | ||
| 234 | && ! deleted_tab | ||
| 235 | && ! (point == ZV || FETCH_CHAR (point) == '\n')) | ||
| 236 | { | ||
| 237 | Finsert_char (make_number (' '), XINT (n)); | ||
| 238 | SET_PT (point - XINT (n)); | ||
| 239 | } | ||
| 240 | |||
| 241 | return value; | ||
| 212 | } | 242 | } |
| 213 | 243 | ||
| 214 | DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p", | 244 | DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p", |