/* undo handling for GNU Emacs.
Copyright (C) 1990, 1993, 1994, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <config.h>
+#include <setjmp.h>
#include "lisp.h"
#include "buffer.h"
#include "commands.h"
undo record that will be added just after this command terminates. */
static void
-record_point (pt)
- int pt;
+record_point (int pt)
{
int at_boundary;
if (NILP (pending_boundary))
pending_boundary = Fcons (Qnil, Qnil);
- if (current_buffer != last_undo_buffer)
+ if ((current_buffer != last_undo_buffer)
+ /* Don't call Fundo_boundary for the first change. Otherwise we
+ risk overwriting last_boundary_position in Fundo_boundary with
+ PT of the current buffer and as a consequence not insert an
+ undo boundary because last_boundary_position will equal pt in
+ the test at the end of the present function (Bug#731). */
+ && (MODIFF > SAVE_MODIFF))
Fundo_boundary ();
last_undo_buffer = current_buffer;
because we don't need to record the contents.) */
void
-record_insert (beg, length)
- int beg, length;
+record_insert (int beg, int length)
{
Lisp_Object lbeg, lend;
of the characters in STRING, at location BEG. */
void
-record_delete (beg, string)
- int beg;
- Lisp_Object string;
+record_delete (int beg, Lisp_Object string)
{
Lisp_Object sbeg;
won't be inverted automatically by undoing the buffer modification. */
void
-record_marker_adjustment (marker, adjustment)
- Lisp_Object marker;
- int adjustment;
+record_marker_adjustment (Lisp_Object marker, int adjustment)
{
if (EQ (current_buffer->undo_list, Qt))
return;
The replacement must not change the number of characters. */
void
-record_change (beg, length)
- int beg, length;
+record_change (int beg, int length)
{
record_delete (beg, make_buffer_string (beg, beg + length, 1));
record_insert (beg, length);
we can tell whether it is obsolete because the file was saved again. */
void
-record_first_change ()
+record_first_change (void)
{
Lisp_Object high, low;
struct buffer *base_buffer = current_buffer;
for LENGTH characters starting at position BEG in BUFFER. */
void
-record_property_change (beg, length, prop, value, buffer)
- int beg, length;
- Lisp_Object prop, value, buffer;
+record_property_change (int beg, int length, Lisp_Object prop, Lisp_Object value, Lisp_Object buffer)
{
Lisp_Object lbeg, lend, entry;
struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer);
In some cases this works by calling undo-outer-limit-function. */
void
-truncate_undo_list (b)
- struct buffer *b;
+truncate_undo_list (struct buffer *b)
{
Lisp_Object list;
Lisp_Object prev, next, last_boundary;
}
\f
void
-syms_of_undo ()
+syms_of_undo (void)
{
- Qinhibit_read_only = intern ("inhibit-read-only");
+ Qinhibit_read_only = intern_c_string ("inhibit-read-only");
staticpro (&Qinhibit_read_only);
- Qapply = intern ("apply");
+ Qapply = intern_c_string ("apply");
staticpro (&Qapply);
pending_boundary = Qnil;
The size is counted as the number of bytes occupied,
which includes both saved text and other data. */);
- undo_limit = 20000;
+ undo_limit = 80000;
DEFVAR_INT ("undo-strong-limit", &undo_strong_limit,
doc: /* Don't keep more than this much size of undo information.
The size is counted as the number of bytes occupied,
which includes both saved text and other data. */);
- undo_strong_limit = 30000;
+ undo_strong_limit = 120000;
DEFVAR_LISP ("undo-outer-limit", &Vundo_outer_limit,
doc: /* Outer limit on size of undo information for one command.
`undo-outer-limit-function' with one argument, the size.
The text above describes the behavior of the function
that variable usually specifies. */);
- Vundo_outer_limit = make_number (3000000);
+ Vundo_outer_limit = make_number (12000000);
DEFVAR_LISP ("undo-outer-limit-function", &Vundo_outer_limit_function,
doc: /* Function to call when an undo list exceeds `undo-outer-limit'.