bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus whenit


From: martin rudalics
Subject: bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus whenit calls `list-processes'
Date: Thu, 26 Jul 2012 11:44:11 +0200

> (add-hook 'after-make-frame-functions
>           (lambda (frame)
>             (redirect-frame-focus frame frame)))
>
> I then ran through the scenario that lead to a crash (C-x C-c, no to exit, 
C-x k
> *shell* + yes, C-x k again, try to type or move cursor).
>
> No crash in this case, but when I try to type something or move the cursor 
after
> the second C-x k (which is the point at which the crash occurred), I can see
> that the input is being sent to buffer & frame *Process List*.  That's not 
what
> you expected, is it?  It is not TRT, in any case.
>
> I do not understand, BTW, why you redirect the focus from the new frame to
> itself, instead of to the minibuffer frame.

I came to this when trying out various scenarios and it seemed this worked
for me.

> So I tried instead redirecting the focus to the minibuffer frame.  That worked
> OK, but the default buffer for killing with C-x k was ` *Minibuf-0*', not
> *shell* or *Process List*.
>
> It seems that when a new frame is created, the default value for C-x k (and
> other buffer commands) becomes *Minibuf-0*.  I can of course choose not to use
> the default value, but it would be good to get this part fixed also.

You mean *Minibuf-0* became the current buffer?  Probably so because you
selected its window.

> Or as a workaround I can explicitly select the frame of the buffer I want to
> kill - e.g., click the title bar of frame *shell*.  After I do that, that 
buffer
> becomes the default value for C-x k.
>
> IOW, it seems that not only is the input focus redirected to the minibuffer
> frame, but also the current buffer is changed to *Minibuf-0*.  And if I do 
`M-:
> (current-buffer)' I do get *Minibuf-0*.  Is it normal for frame-focus
> redirection to change the current buffer also?  That does not seem right to 
me.

I nowhere in the code see that it does.  Are you sure you did not use
`select-frame-set-input-focus' in this case?

> Anyway, aside from this problem of default value for C-x k, things seemed to
> work OK.  So overall this seems like a reasonable solution, except for the
> default buffer problem.  This is all I did, along with my usual setup:
>
> (add-hook 'after-make-frame-functions
>           (lambda (frame)
>             (redirect-frame-focus frame (window-frame (minibuffer-window)))))

That was my initial idea.  I forgot why it didn't work (maybe it failed
when I created a new frame with a minibuffer).

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]