comparison src/undo.c @ 3696:aa9310f06c0f

(syms_of_undo): Set up Qinhibit_read_only. (Fprimitive_undo): Sometimes bind inhibit-read-only to t.
author Richard M. Stallman <rms@gnu.org>
date Sat, 12 Jun 1993 18:10:20 +0000
parents 54381151027d
children 695181e4bc20
comparison
equal deleted inserted replaced
3695:674fb551b693 3696:aa9310f06c0f
23 #include "lisp.h" 23 #include "lisp.h"
24 #include "buffer.h" 24 #include "buffer.h"
25 25
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
29 Lisp_Object Qinhibit_read_only;
28 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
32 because we don't need to record the contents.) */ 34 because we don't need to record the contents.) */
284 "Undo N records from the front of the list LIST.\n\ 286 "Undo N records from the front of the list LIST.\n\
285 Return what remains of the list.") 287 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. */
292 Lisp_Object tem; 295 Lisp_Object tem;
293 296
295 preceding this command. Get rid of it and don't count it. */ 298 preceding this command. Get rid of it and don't count it. */
296 tem = Fcar (list); 299 tem = Fcar (list);
297 if (NILP (tem)) 300 if (NILP (tem))
298 list = Fcdr (list); 301 list = Fcdr (list);
299 #endif 302 #endif
303
304 /* Don't let read-only properties interfere with undo. */
305 if (NILP (current_buffer->read_only))
306 specbind (Qinhibit_read_only, Qt);
300 307
301 while (arg > 0) 308 while (arg > 0)
302 { 309 {
303 while (1) 310 while (1)
304 { 311 {
399 } 406 }
400 } 407 }
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 }