GNU bug report logs - #11939
24.1; `save-buffers-kill-emacs' loses minibuffer focus when it calls `list-processes'

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Fri, 13 Jul 2012 18:07:01 UTC

Severity: normal

Found in version 24.1

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


Message #212 received at 11939 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 11939 <at> debbugs.gnu.org
Subject: Re: 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




This bug report was last modified 12 years and 288 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.