Mercurial > hg > xemacs-beta
changeset 3698:7d97cf62c899
[xemacs-hg @ 2006-11-24 13:45:37 by aidan]
Within truncate-command-history-for-gc, delay execution of all things that look up variable bindings, via 'enqueue-eval-event'.
author | aidan |
---|---|
date | Fri, 24 Nov 2006 13:45:38 +0000 |
parents | 29836a140619 |
children | 5155e1ab55ae |
files | lisp/ChangeLog lisp/cmdloop.el |
diffstat | 2 files changed, 26 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Nov 23 22:51:07 2006 +0000 +++ b/lisp/ChangeLog Fri Nov 24 13:45:38 2006 +0000 @@ -1,3 +1,9 @@ +2004-06-28 Nix <nix@esperi.org.uk> + + * cmdloop.el (truncate-command-history-for-gc): Delay + execution of all things that look up variable bindings, + via `enqueue-eval-event'. + 2006-11-14 Stephen J. Turnbull <stephen@xemacs.org> * info.el (Info-find-file-node, Info-insert-dir)
--- a/lisp/cmdloop.el Thu Nov 23 22:51:07 2006 +0000 +++ b/lisp/cmdloop.el Fri Nov 24 13:45:38 2006 +0000 @@ -183,11 +183,26 @@ (defun truncate-command-history-for-gc () - (let ((tail (nthcdr 30 command-history))) - (if tail (setcdr tail nil))) - (let ((tail (nthcdr 30 values))) - (if tail (setcdr tail nil))) - ) + ;; We should try to avoid accessing any bindings to speak of in this + ;; function; as this hook is called asynchronously, the search for + ;; those bindings might search local bindings from essentially + ;; arbitrary functions. We force the body of the function to run at + ;; command-loop level, where the danger of local bindings is much + ;; reduced; the code can still do its job because the command history + ;; and values list will not grow before then anyway. + ;; + ;; Nothing is done in batch mode, both because it is a waste of time + ;; (there is no command loop!) and because this any GCs during dumping + ;; will invoke this code, and if it were to enqueue an eval event, + ;; the portable dumper would try to dump it and fail. + (if (not (noninteractive)) + (enqueue-eval-event + (lambda (arg) + (let ((tail (nthcdr 30 command-history))) + (if tail (setcdr tail nil))) + (let ((tail (nthcdr 30 values))) + (if tail (setcdr tail nil)))) + nil))) (add-hook 'pre-gc-hook 'truncate-command-history-for-gc)