X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fcmdloop.el;h=6d972de44652f3c60f4058d79310d843f92ebc48;hb=1d0cc750fca3431b5c4d6df5419f6832198f0298;hp=17989d00ccd5eb9ee73fcd2f8383048208483f34;hpb=59eec5f21669e81977b5b1fe9bf717cab49cf7fb;p=chise%2Fxemacs-chise.git.1 diff --git a/lisp/cmdloop.el b/lisp/cmdloop.el index 17989d0..6d972de 100644 --- a/lisp/cmdloop.el +++ b/lisp/cmdloop.el @@ -70,8 +70,7 @@ If this character is typed at top-level, this simply beeps. If `zmacs-regions' is true, and the zmacs region is active in this buffer, then this key deactivates the region without beeping or signalling." (interactive) - (if (and (region-active-p) - (eq (current-buffer) (zmacs-region-buffer))) + (if (region-active-p) ;; pseudo-zmacs compatibility: don't beep if this ^G is simply ;; deactivating the region. If it is inactive, beep. nil @@ -187,11 +186,26 @@ or go back to just one window (by deleting all but the selected window)." (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) @@ -391,7 +405,7 @@ when called from Lisp." ; (call-interactively _command _record-flag))))) (defun y-or-n-p-minibuf (prompt) - "Ask user a \"y or n\" question. Return t if answer is \"y\". + "Ask user a \"y or n\" question. Return t if answer is \"y\", nil if \"n\". Takes one argument, which is the string to display to ask the question. It should end in a space; `y-or-n-p' adds `(y or n) ' to it. No confirmation of the answer is requested; a single character is enough. @@ -474,7 +488,7 @@ and can edit it until it as been confirmed." (yes-or-no-p-minibuf prompt))) (defun y-or-n-p (prompt) - "Ask user a \"y or n\" question. Return t if answer is \"y\". + "Ask user a \"y or n\" question. Return t if answer is \"y\", nil if \"n\". Takes one argument, which is the string to display to ask the question. The question is asked with a dialog box or the minibuffer, as appropriate. It should end in a space; `y-or-n-p' adds `(y or n) ' to it.