diff options
| author | Richard M. Stallman | 1993-06-12 18:10:20 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-12 18:10:20 +0000 |
| commit | f87a68b369018158bbddabbec049a7d4e2df52ee (patch) | |
| tree | aa58f1594726730c3850f272ce8929ca72ec2930 | |
| parent | a6d570c63744de993bd15eb3fddb0205d04a163b (diff) | |
| download | emacs-f87a68b369018158bbddabbec049a7d4e2df52ee.tar.gz emacs-f87a68b369018158bbddabbec049a7d4e2df52ee.zip | |
(syms_of_undo): Set up Qinhibit_read_only.
(Fprimitive_undo): Sometimes bind inhibit-read-only to t.
| -rw-r--r-- | src/undo.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/undo.c b/src/undo.c index 18bfc3a3b2b..1c399fb873f 100644 --- a/src/undo.c +++ b/src/undo.c | |||
| @@ -26,6 +26,8 @@ and this notice must be preserved on all copies. */ | |||
| 26 | /* Last buffer for which undo information was recorded. */ | 26 | /* Last buffer for which undo information was recorded. */ |
| 27 | Lisp_Object last_undo_buffer; | 27 | Lisp_Object last_undo_buffer; |
| 28 | 28 | ||
| 29 | Lisp_Object Qinhibit_read_only; | ||
| 30 | |||
| 29 | /* Record an insertion that just happened or is about to happen, | 31 | /* Record an insertion that just happened or is about to happen, |
| 30 | for LENGTH characters at position BEG. | 32 | for LENGTH characters at position BEG. |
| 31 | (It is possible to record an insertion before or after the fact | 33 | (It is possible to record an insertion before or after the fact |
| @@ -286,6 +288,7 @@ Return what remains of the list.") | |||
| 286 | (count, list) | 288 | (count, list) |
| 287 | Lisp_Object count, list; | 289 | Lisp_Object count, list; |
| 288 | { | 290 | { |
| 291 | int count = specpdl_ptr - specpdl; | ||
| 289 | register int arg = XINT (count); | 292 | register int arg = XINT (count); |
| 290 | #if 0 /* This is a good feature, but would make undo-start | 293 | #if 0 /* This is a good feature, but would make undo-start |
| 291 | unable to do what is expected. */ | 294 | unable to do what is expected. */ |
| @@ -298,6 +301,10 @@ Return what remains of the list.") | |||
| 298 | list = Fcdr (list); | 301 | list = Fcdr (list); |
| 299 | #endif | 302 | #endif |
| 300 | 303 | ||
| 304 | /* Don't let read-only properties interfere with undo. */ | ||
| 305 | if (NILP (current_buffer->read_only)) | ||
| 306 | specbind (Qinhibit_read_only, Qt); | ||
| 307 | |||
| 301 | while (arg > 0) | 308 | while (arg > 0) |
| 302 | { | 309 | { |
| 303 | while (1) | 310 | while (1) |
| @@ -401,11 +408,14 @@ Return what remains of the list.") | |||
| 401 | arg--; | 408 | arg--; |
| 402 | } | 409 | } |
| 403 | 410 | ||
| 404 | return list; | 411 | return unbind_to (count, list); |
| 405 | } | 412 | } |
| 406 | 413 | ||
| 407 | syms_of_undo () | 414 | syms_of_undo () |
| 408 | { | 415 | { |
| 416 | Qinhibit_read_only = intern ("inhibit-read-only"); | ||
| 417 | staticpro (&Qinhibit_read_only); | ||
| 418 | |||
| 409 | defsubr (&Sprimitive_undo); | 419 | defsubr (&Sprimitive_undo); |
| 410 | defsubr (&Sundo_boundary); | 420 | defsubr (&Sundo_boundary); |
| 411 | } | 421 | } |