/* Simple built-in editing commands.
-Copyright (C) 1985, 1993-1998, 2001-2013 Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1998, 2001-2014 Free Software Foundation, Inc.
This file is part of GNU Emacs.
count = XINT (n);
}
- if (count <= 0)
- pos = find_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, count - 1,
- &shortage, &pos_byte, 1);
- else
- pos = find_newline (PT, PT_BYTE, ZV, ZV_BYTE, count,
- &shortage, &pos_byte, 1);
+ shortage = scan_newline_from_point (count, &pos, &pos_byte);
SET_PT_BOTH (pos, pos_byte);
Interactively, N is the prefix arg, and KILLFLAG is set if
N was explicitly specified.
-The command `delete-forward-char' is preferable for interactive use. */)
+The command `delete-forward-char' is preferable for interactive use, e.g.
+because it respects values of `delete-active-region' and `overwrite-mode'. */)
(Lisp_Object n, Lisp_Object killflag)
{
EMACS_INT pos;
DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p",
doc: /* Insert the character you type.
Whichever character you type to run this command is inserted.
+The numeric prefix argument N says how many times to repeat the insertion.
Before insertion, `expand-abbrev' is executed if the inserted character does
not have word syntax and the previous character in the buffer does.
After insertion, the value of `auto-fill-function' is called if the
(Lisp_Object n)
{
bool remove_boundary = 1;
- CHECK_NATNUM (n);
+ CHECK_NUMBER (n);
+
+ if (XFASTINT (n) < 0)
+ error ("Negative repetition argument %"pI"d", XFASTINT (n));
if (!EQ (Vthis_command, KVAR (current_kboard, Vlast_command)))
nonundocount = 0;
int val = internal_self_insert (character, XFASTINT (n));
if (val == 2)
nonundocount = 0;
- frame_make_pointer_invisible ();
+ frame_make_pointer_invisible (SELECTED_FRAME ());
}
return Qnil;
}
else
{
- str[0] = (SINGLE_BYTE_CHAR_P (c)
- ? c
- : multibyte_char_to_unibyte (c));
+ str[0] = SINGLE_BYTE_CHAR_P (c) ? c : CHAR_TO_BYTE8 (c);
len = 1;
}
if (!NILP (overwrite)