Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
e3d5ca1e
Commit
e3d5ca1e
authored
May 29, 2004
by
Richard M. Stallman
Browse files
(truncate_undo_list): New arg LIMITSIZE.
parent
ae6a9bfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
src/undo.c
src/undo.c
+16
-6
No files found.
src/undo.c
View file @
e3d5ca1e
...
...
@@ -292,14 +292,15 @@ but another undo command will undo to the previous boundary. */)
/* At garbage collection time, make an undo list shorter at the end,
returning the truncated list.
MINSIZE and MAXSIZE are the limits on size allowed, as described below.
In practice, these are the values of undo-limit and
undo-strong-limit. */
MINSIZE, MAXSIZE and LIMITSIZE are the limits on size allowed,
as described below.
In practice, these are the values of undo-limit,
undo-strong-limit, and undo-outer-limit. */
Lisp_Object
truncate_undo_list
(
list
,
minsize
,
maxsize
)
truncate_undo_list
(
list
,
minsize
,
maxsize
,
limitsize
)
Lisp_Object
list
;
int
minsize
,
maxsize
;
int
minsize
,
maxsize
,
limitsize
;
{
Lisp_Object
prev
,
next
,
last_boundary
;
int
size_so_far
=
0
;
...
...
@@ -308,7 +309,8 @@ truncate_undo_list (list, minsize, maxsize)
next
=
list
;
last_boundary
=
Qnil
;
/* Always preserve at least the most recent undo record.
/* Always preserve at least the most recent undo record
unless it is really horribly big.
If the first element is an undo boundary, skip past it.
Skip, skip, skip the undo, skip, skip, skip the undo,
...
...
@@ -323,6 +325,7 @@ truncate_undo_list (list, minsize, maxsize)
prev
=
next
;
next
=
XCDR
(
next
);
}
while
(
CONSP
(
next
)
&&
!
NILP
(
XCAR
(
next
)))
{
Lisp_Object
elt
;
...
...
@@ -338,13 +341,20 @@ truncate_undo_list (list, minsize, maxsize)
+
SCHARS
(
XCAR
(
elt
)));
}
/* If we reach LIMITSIZE before the first boundary,
we're heading for memory full, so truncate the list to nothing. */
if
(
size_so_far
>
limitsize
)
return
Qnil
;
/* Advance to next element. */
prev
=
next
;
next
=
XCDR
(
next
);
}
if
(
CONSP
(
next
))
last_boundary
=
prev
;
/* Keep more if it fits. */
while
(
CONSP
(
next
))
{
Lisp_Object
elt
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment