[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C-g while exiting the minibuffer
From: |
Stefan Monnier |
Subject: |
C-g while exiting the minibuffer |
Date: |
Wed, 27 Nov 2013 16:15:00 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
I've been trying to track down a performance problem I've been
experimenting for a while now. Along the way I found that the problem
shows up when frame-focus is redirected (at least, it's a necessary
ingredient, tho not sufficient).
But I also found out that sometimes I have a redirected frame-focus for
no reason. And I finally yesterday caught the bugger that causes this:
C-h right while exiting the minibuffer: my minibuffer is in a separate
frame, so while in the minibuffer, the frame-focus is redirected (this
is perfectly normal so far). When exiting the minibuffer, this focus is
supposed to be canceled, but this cancellation can fail:
the cancellation is done implicitly by the restoration of the previous
window-configuration. The problem being that Fset_window_configuration
does
/* In the following call to `select-window', prevent "swapping out
point" in the old selected window using the buffer that has
been restored into it. We already swapped out that point from
that window's old buffer. */
select_window (data->current_window, Qnil, 1);
BVAR (XBUFFER (XWINDOW (selected_window)->contents), last_selected_window)
= selected_window;
just before
if (NILP (data->focus_frame)
|| (FRAMEP (data->focus_frame)
&& FRAME_LIVE_P (XFRAME (data->focus_frame))))
Fredirect_frame_focus (frame, data->focus_frame);
IOW just before resetting the frame-focus, we select the
selected-window. So far this looks innocuous, but select_window (with
a 1 as last argument) calls record_buffer which calls Fdelq which uses
QUIT, so if you happen to hit C-g at the right time, the frame-focus
redirection is not properly canceled.
Now I wonder what should be the best way to fix this. I can just switch
the above two code blocks, which will fix the immediate problem (a C-g
will not prevent canceling the frame-focus redirected), but I think this
points to a larger problem of hitting C-g while processing unwind forms.
Of course binding inhibit-quit during processing of unwind forms could
be a source of problem in itself (if those forms fail to terminate).
Any comment/idea/suggestion?
Stefan
- C-g while exiting the minibuffer,
Stefan Monnier <=