diff options
| author | Jim Blandy | 1993-03-16 18:18:05 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-03-16 18:18:05 +0000 |
| commit | 6bbb0d4aaa68a2976cf3883fff8068c57f7a6bfa (patch) | |
| tree | 057fe5c5fdf095d8dc791f54ec793e60942149be | |
| parent | 80169ab5392d1bd5df9f6147bbb47e0edcba43fa (diff) | |
| download | emacs-6bbb0d4aaa68a2976cf3883fff8068c57f7a6bfa.tar.gz emacs-6bbb0d4aaa68a2976cf3883fff8068c57f7a6bfa.zip | |
* cmds.c (overwrite_binary_mode): Deleted; this implements the
wrong feature.
(Qoverwrite_mode_binary): New variable.
(internal_self_insert): If current_buffer->overwrite_mode is
`overwrite-mode-binary', do as overwrite_binary_mode used to.
(syms_of_cmds): Remove defvar of overwrite_binary_mode; initialize
Qoverwrite_mode_binary.
* buffer.c (syms_of_buffer): Doc fix for overwrite_mode.
* buffer.h (struct buffer): Doc fix.
| -rw-r--r-- | src/buffer.c | 4 | ||||
| -rw-r--r-- | src/buffer.h | 3 | ||||
| -rw-r--r-- | src/cmds.c | 19 |
3 files changed, 16 insertions, 10 deletions
diff --git a/src/buffer.c b/src/buffer.c index e254db179c7..aec489eab56 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1610,6 +1610,10 @@ Automatically becomes buffer-local when set in any fashion."); | |||
| 1610 | 1610 | ||
| 1611 | DEFVAR_PER_BUFFER ("overwrite-mode", ¤t_buffer->overwrite_mode, Qnil, | 1611 | DEFVAR_PER_BUFFER ("overwrite-mode", ¤t_buffer->overwrite_mode, Qnil, |
| 1612 | "Non-nil if self-insertion should replace existing text.\n\ | 1612 | "Non-nil if self-insertion should replace existing text.\n\ |
| 1613 | If non-nil and not `overwrite-mode-binary', self-insertion still\n\ | ||
| 1614 | inserts at the end of a line, and inserts when point is before a tab,\n\ | ||
| 1615 | unless that tab is displaying as only one space.\n\ | ||
| 1616 | If `overwrite-mode-binary', self-insertion replaces newlines and tabs too.\n\ | ||
| 1613 | Automatically becomes buffer-local when set in any fashion."); | 1617 | Automatically becomes buffer-local when set in any fashion."); |
| 1614 | 1618 | ||
| 1615 | DEFVAR_PER_BUFFER ("buffer-display-table", ¤t_buffer->display_table, | 1619 | DEFVAR_PER_BUFFER ("buffer-display-table", ¤t_buffer->display_table, |
diff --git a/src/buffer.h b/src/buffer.h index 99f30d0315f..35a7d62685d 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -256,7 +256,8 @@ struct buffer | |||
| 256 | #endif | 256 | #endif |
| 257 | /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ | 257 | /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ |
| 258 | Lisp_Object minor_modes; | 258 | Lisp_Object minor_modes; |
| 259 | /* t if "self-insertion" should overwrite */ | 259 | /* t if "self-insertion" should overwrite; `binary' if it should also |
| 260 | overwrite newlines and tabs - for editing executables and the like. */ | ||
| 260 | Lisp_Object overwrite_mode; | 261 | Lisp_Object overwrite_mode; |
| 261 | /* non-nil means abbrev mode is on. Expand abbrevs automatically. */ | 262 | /* non-nil means abbrev mode is on. Expand abbrevs automatically. */ |
| 262 | Lisp_Object abbrev_mode; | 263 | Lisp_Object abbrev_mode; |
diff --git a/src/cmds.c b/src/cmds.c index 9dfd2b48a8f..e81d7c61e59 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -26,7 +26,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 26 | 26 | ||
| 27 | Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function; | 27 | Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function; |
| 28 | 28 | ||
| 29 | int overwrite_binary_mode; | 29 | /* A possible value for a buffer's overwrite-mode variable. */ |
| 30 | Lisp_Object Qoverwrite_mode_binary; | ||
| 31 | |||
| 30 | 32 | ||
| 31 | DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p", | 33 | DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p", |
| 32 | "Move point right ARG characters (left if ARG negative).\n\ | 34 | "Move point right ARG characters (left if ARG negative).\n\ |
| @@ -273,14 +275,16 @@ internal_self_insert (c1, noautofill) | |||
| 273 | Lisp_Object tem; | 275 | Lisp_Object tem; |
| 274 | register enum syntaxcode synt; | 276 | register enum syntaxcode synt; |
| 275 | register int c = c1; | 277 | register int c = c1; |
| 278 | Lisp_Object overwrite = current_buffer->overwrite_mode; | ||
| 276 | 279 | ||
| 277 | if (!NILP (Vbefore_change_function) || !NILP (Vafter_change_function)) | 280 | if (!NILP (Vbefore_change_function) || !NILP (Vafter_change_function)) |
| 278 | hairy = 1; | 281 | hairy = 1; |
| 279 | 282 | ||
| 280 | if (!NILP (current_buffer->overwrite_mode) | 283 | if (!NILP (overwrite) |
| 281 | && point < ZV | 284 | && point < ZV |
| 282 | && (overwrite_binary_mode || (c != '\n' && FETCH_CHAR (point) != '\n')) | 285 | && (EQ (overwrite, Qoverwrite_mode_binary) |
| 283 | && (overwrite_binary_mode | 286 | || (c != '\n' && FETCH_CHAR (point) != '\n')) |
| 287 | && (EQ (overwrite, Qoverwrite_mode_binary) | ||
| 284 | || FETCH_CHAR (point) != '\t' | 288 | || FETCH_CHAR (point) != '\t' |
| 285 | || XINT (current_buffer->tab_width) <= 0 | 289 | || XINT (current_buffer->tab_width) <= 0 |
| 286 | || XFASTINT (current_buffer->tab_width) > 20 | 290 | || XFASTINT (current_buffer->tab_width) > 20 |
| @@ -336,11 +340,8 @@ syms_of_cmds () | |||
| 336 | Qkill_forward_chars = intern ("kill-forward-chars"); | 340 | Qkill_forward_chars = intern ("kill-forward-chars"); |
| 337 | staticpro (&Qkill_forward_chars); | 341 | staticpro (&Qkill_forward_chars); |
| 338 | 342 | ||
| 339 | DEFVAR_BOOL ("overwrite-binary-mode", &overwrite_binary_mode, | 343 | Qoverwrite_mode_binary = intern ("overwrite-mode-binary"); |
| 340 | "*Non-nil means overwrite mode treats tab and newline normally.\n\ | 344 | staticpro (&Qoverwrite_mode_binary); |
| 341 | Ordinarily, overwriting preserves a tab until its whole width is overwritten\n\ | ||
| 342 | and never replaces a newline."); | ||
| 343 | overwrite_binary_mode = 1; | ||
| 344 | 345 | ||
| 345 | DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function, | 346 | DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function, |
| 346 | "Function called, if non-nil, whenever a close parenthesis is inserted.\n\ | 347 | "Function called, if non-nil, whenever a close parenthesis is inserted.\n\ |