aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2010-06-27 21:01:11 -0400
committerChong Yidong2010-06-27 21:01:11 -0400
commitb92296739624ac4928d7ed90155b4ee91625fea4 (patch)
tree987fb8c53b7d247c228c6910e2315b5183233dee /src
parentbbc803b0bc876ed1f548cdbfc20fd819a430f0ac (diff)
downloademacs-b92296739624ac4928d7ed90155b4ee91625fea4.tar.gz
emacs-b92296739624ac4928d7ed90155b4ee91625fea4.zip
* bindings.el (global-map): Bind delete and DEL, the former to
delete-forward-char. * mouse.el (mouse-region-delete-keys): Deleted. (mouse-show-mark): Simplify. * simple.el (delete-active-region): New option. (delete-backward-char): Implement in Lisp. (delete-forward-char): New command. * src/cmds.c (Fdelete_backward_char): Move into Lisp.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/cmds.c62
2 files changed, 7 insertions, 59 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 12e45710e62..18e12b5e022 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
12010-06-28 Chong Yidong <cyd@stupidchicken.com>
2
3 * cmds.c (Fdelete_backward_char): Move into Lisp.
4
12010-06-27 Dan Nicolaescu <dann@ics.uci.edu> 52010-06-27 Dan Nicolaescu <dann@ics.uci.edu>
2 6
3 * s/freebsd.h (BSD4_2): Remove redundant definition. 7 * s/freebsd.h (BSD4_2): Remove redundant definition.
diff --git a/src/cmds.c b/src/cmds.c
index ba89c532be8..465fce18a4b 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -240,7 +240,9 @@ DEFUN ("delete-char", Fdelete_char, Sdelete_char, 1, 2, "p\nP",
240 doc: /* Delete the following N characters (previous if N is negative). 240 doc: /* Delete the following N characters (previous if N is negative).
241Optional second arg KILLFLAG non-nil means kill instead (save in kill ring). 241Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).
242Interactively, N is the prefix arg, and KILLFLAG is set if 242Interactively, N is the prefix arg, and KILLFLAG is set if
243N was explicitly specified. */) 243N was explicitly specified.
244
245The command `delete-forward' is preferable for interactive use. */)
244 (n, killflag) 246 (n, killflag)
245 Lisp_Object n, killflag; 247 Lisp_Object n, killflag;
246{ 248{
@@ -273,60 +275,6 @@ N was explicitly specified. */)
273 return Qnil; 275 return Qnil;
274} 276}
275 277
276DEFUN ("delete-backward-char", Fdelete_backward_char, Sdelete_backward_char,
277 1, 2, "p\nP",
278 doc: /* Delete the previous N characters (following if N is negative).
279Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).
280Interactively, N is the prefix arg, and KILLFLAG is set if
281N was explicitly specified.
282This is meant for interactive use only; from Lisp, better use `delete-char'
283with a negated argument. */)
284 (n, killflag)
285 Lisp_Object n, killflag;
286{
287 Lisp_Object value;
288 int deleted_special = 0;
289 int pos, pos_byte, i;
290
291 CHECK_NUMBER (n);
292
293 /* See if we are about to delete a tab or newline backwards. */
294 pos = PT;
295 pos_byte = PT_BYTE;
296 for (i = 0; i < XINT (n) && pos_byte > BEGV_BYTE; i++)
297 {
298 int c;
299
300 DEC_BOTH (pos, pos_byte);
301 c = FETCH_BYTE (pos_byte);
302 if (c == '\t' || c == '\n')
303 {
304 deleted_special = 1;
305 break;
306 }
307 }
308
309 /* In overwrite mode, back over columns while clearing them out,
310 unless at end of line. */
311 if (XINT (n) > 0
312 && ! NILP (current_buffer->overwrite_mode)
313 && ! deleted_special
314 && ! (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n'))
315 {
316 int column = (int) current_column (); /* iftc */
317
318 value = Fdelete_char (make_number (-XINT (n)), killflag);
319 i = column - (int) current_column (); /* iftc */
320 Finsert_char (make_number (' '), make_number (i), Qnil);
321 /* Whitespace chars are ASCII chars, so we can simply subtract. */
322 SET_PT_BOTH (PT - i, PT_BYTE - i);
323 }
324 else
325 value = Fdelete_char (make_number (-XINT (n)), killflag);
326
327 return value;
328}
329
330static int nonundocount; 278static int nonundocount;
331 279
332/* Note that there's code in command_loop_1 which typically avoids 280/* Note that there's code in command_loop_1 which typically avoids
@@ -635,8 +583,6 @@ More precisely, a char with closeparen syntax is self-inserted. */);
635 defsubr (&Send_of_line); 583 defsubr (&Send_of_line);
636 584
637 defsubr (&Sdelete_char); 585 defsubr (&Sdelete_char);
638 defsubr (&Sdelete_backward_char);
639
640 defsubr (&Sself_insert_command); 586 defsubr (&Sself_insert_command);
641} 587}
642 588
@@ -658,10 +604,8 @@ keys_of_cmds ()
658 604
659 initial_define_key (global_map, Ctl ('A'), "beginning-of-line"); 605 initial_define_key (global_map, Ctl ('A'), "beginning-of-line");
660 initial_define_key (global_map, Ctl ('B'), "backward-char"); 606 initial_define_key (global_map, Ctl ('B'), "backward-char");
661 initial_define_key (global_map, Ctl ('D'), "delete-char");
662 initial_define_key (global_map, Ctl ('E'), "end-of-line"); 607 initial_define_key (global_map, Ctl ('E'), "end-of-line");
663 initial_define_key (global_map, Ctl ('F'), "forward-char"); 608 initial_define_key (global_map, Ctl ('F'), "forward-char");
664 initial_define_key (global_map, 0177, "delete-backward-char");
665} 609}
666 610
667/* arch-tag: 022ba3cd-67f9-4978-9c5d-7d2b18d8644e 611/* arch-tag: 022ba3cd-67f9-4978-9c5d-7d2b18d8644e