(HAVE_TERMIO, SIGNALS_VIA_CHARACTERS): Defined.
[bpt/emacs.git] / src / cmds.c
index c8e9bfd..e81d7c6 100644 (file)
@@ -26,6 +26,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function;
 
+/* A possible value for a buffer's overwrite-mode variable.  */
+Lisp_Object Qoverwrite_mode_binary;
+
 \f
 DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p",
   "Move point right ARG characters (left if ARG negative).\n\
@@ -229,13 +232,14 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long.")
   if (!NILP (current_buffer->read_only))
     Fsignal (Qbuffer_read_only, Qnil);
 
-  /* Inserting a newline at the end of a line
-     produces better redisplay in try_window_id
-     than inserting at the ebginning fo a line,
-     And the textual result is the same.
-     So if at beginning, pretend to be at the end.
-     Must avoid internal_self_insert in that case since point is wrong.
-     Luckily internal_self_insert's special features all do nothing in that case.  */
+  /* Inserting a newline at the end of a line produces better
+     redisplay in try_window_id than inserting at the ebginning fo a
+     line, and the textual result is the same.  So, if we're at
+     beginning of line, pretend to be at the end of the previous line.  
+
+     We can't use internal_self_insert in that case since it won't do
+     the insertion correctly.  Luckily, internal_self_insert's special
+     features all do nothing in that case.  */
 
   flag = point > BEGV && FETCH_CHAR (point - 1) == '\n';
   if (flag)
@@ -271,15 +275,19 @@ internal_self_insert (c1, noautofill)
   Lisp_Object tem;
   register enum syntaxcode synt;
   register int c = c1;
+  Lisp_Object overwrite = current_buffer->overwrite_mode;
 
   if (!NILP (Vbefore_change_function) || !NILP (Vafter_change_function))
     hairy = 1;
 
-  if (!NILP (current_buffer->overwrite_mode)
+  if (!NILP (overwrite)
       && point < ZV
-      && c != '\n' && FETCH_CHAR (point) != '\n'
-      && (FETCH_CHAR (point) != '\t'
+      && (EQ (overwrite, Qoverwrite_mode_binary)
+         || (c != '\n' && FETCH_CHAR (point) != '\n'))
+      && (EQ (overwrite, Qoverwrite_mode_binary)
+         || FETCH_CHAR (point) != '\t'
          || XINT (current_buffer->tab_width) <= 0
+         || XFASTINT (current_buffer->tab_width) > 20
          || !((current_column () + 1) % XFASTINT (current_buffer->tab_width))))
     {
       del_range (point, point + 1);
@@ -332,6 +340,9 @@ syms_of_cmds ()
   Qkill_forward_chars = intern ("kill-forward-chars");
   staticpro (&Qkill_forward_chars);
 
+  Qoverwrite_mode_binary = intern ("overwrite-mode-binary");
+  staticpro (&Qoverwrite_mode_binary);
+
   DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function,
     "Function called, if non-nil, whenever a close parenthesis is inserted.\n\
 More precisely, a char with closeparen syntax is self-inserted.");