aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-01-29 23:27:09 +0000
committerRichard M. Stallman1996-01-29 23:27:09 +0000
commitaa970069e0e4caa2d93687c8456b922911ec70c6 (patch)
tree910857a8b5bbf00a9085c5d7c0b6f7086213dd34 /src
parent68313ed8befeec78901828ba690858f7db2a15b4 (diff)
downloademacs-aa970069e0e4caa2d93687c8456b922911ec70c6.tar.gz
emacs-aa970069e0e4caa2d93687c8456b922911ec70c6.zip
(Fdelete_backward_char): In overwrite mode,
insert spaces, unless we deleted a tab.
Diffstat (limited to 'src')
-rw-r--r--src/cmds.c34
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
4This file is part of GNU Emacs. 4This 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
214DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p", 244DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p",