X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/4170f62f39edf1ff1e99aec9bfbfe7bbf10e7fc9..71873e2b335b721e0b3c585e88211c9564f4c743:/src/undo.c diff --git a/src/undo.c b/src/undo.c index 80aff50d18..b0acd0c216 100644 --- a/src/undo.c +++ b/src/undo.c @@ -1,5 +1,5 @@ /* undo handling for GNU Emacs. - Copyright (C) 1990, 1993-1994, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1990, 1993-1994, 2000-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -212,7 +212,6 @@ record_change (EMACS_INT beg, EMACS_INT length) void record_first_change (void) { - Lisp_Object high, low; struct buffer *base_buffer = current_buffer; if (EQ (BVAR (current_buffer, undo_list), Qt)) @@ -225,9 +224,9 @@ record_first_change (void) if (base_buffer->base_buffer) base_buffer = base_buffer->base_buffer; - XSETFASTINT (high, (base_buffer->modtime >> 16) & 0xffff); - XSETFASTINT (low, base_buffer->modtime & 0xffff); - BVAR (current_buffer, undo_list) = Fcons (Fcons (Qt, Fcons (high, low)), BVAR (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) = + Fcons (Fcons (Qt, INTEGER_TO_CONS (base_buffer->modtime)), + BVAR (current_buffer, undo_list)); } /* Record a change in property PROP (whose old value was VAL) @@ -437,6 +436,13 @@ truncate_undo_list (struct buffer *b) unbind_to (count, Qnil); } + +static void user_error (const char*) NO_RETURN; +static void user_error (const char *msg) +{ + xsignal1 (Quser_error, build_string (msg)); +} + DEFUN ("primitive-undo", Fprimitive_undo, Sprimitive_undo, 2, 2, 0, doc: /* Undo N records from the front of the list LIST. @@ -499,13 +505,9 @@ Return what remains of the list. */) if (EQ (car, Qt)) { /* Element (t high . low) records previous modtime. */ - Lisp_Object high, low; - int mod_time; struct buffer *base_buffer = current_buffer; - - high = Fcar (cdr); - low = Fcdr (cdr); - mod_time = (XFASTINT (high) << 16) + XFASTINT (low); + time_t mod_time; + CONS_TO_INTEGER (cdr, time_t, mod_time); if (current_buffer->base_buffer) base_buffer = current_buffer->base_buffer; @@ -533,7 +535,7 @@ Return what remains of the list. */) end = Fcdr (cdr); if (XINT (beg) < BEGV || XINT (end) > ZV) - error ("Changes to be undone are outside visible portion of buffer"); + user_error ("Changes to be undone are outside visible portion of buffer"); Fput_text_property (beg, end, prop, val, Qnil); } else if (INTEGERP (car) && INTEGERP (cdr)) @@ -542,7 +544,7 @@ Return what remains of the list. */) if (XINT (car) < BEGV || XINT (cdr) > ZV) - error ("Changes to be undone are outside visible portion of buffer"); + user_error ("Changes to be undone are outside visible portion of buffer"); /* Set point first thing, so that undoing this undo does not send point back to where it is now. */ Fgoto_char (car); @@ -593,14 +595,14 @@ Return what remains of the list. */) if (pos < 0) { if (-pos < BEGV || -pos > ZV) - error ("Changes to be undone are outside visible portion of buffer"); + user_error ("Changes to be undone are outside visible portion of buffer"); SET_PT (-pos); Finsert (1, &membuf); } else { if (pos < BEGV || pos > ZV) - error ("Changes to be undone are outside visible portion of buffer"); + user_error ("Changes to be undone are outside visible portion of buffer"); SET_PT (pos); /* Now that we record marker adjustments @@ -642,11 +644,8 @@ Return what remains of the list. */) void syms_of_undo (void) { - Qinhibit_read_only = intern_c_string ("inhibit-read-only"); - staticpro (&Qinhibit_read_only); - - Qapply = intern_c_string ("apply"); - staticpro (&Qapply); + DEFSYM (Qinhibit_read_only, "inhibit-read-only"); + DEFSYM (Qapply, "apply"); pending_boundary = Qnil; staticpro (&pending_boundary);