From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus when it calls `list-processes' Date: Sun, 22 Jul 2012 10:48:47 +0200 Message-ID: <500BBE6F.6020007@gmx.at> References: <500173A5.3040608@gmx.at> <1986D90E22154321A44B6E0110CA4F5A@us.oracle.com> <50019C2F.8060103@gmx.at> <6B9036DBFDEF4881AB39804520BF63B3@us.oracle.com> <5002BEC6.3040106@gmx.at> <893E59C2E4F94D6EB910560C9E8C42CD@us.oracle.com> <5002EAF4.5080107@gmx.at> <6F73D04E8EE144E780D602DFEBA48E7B@us.oracle.com> <5003DAF2.2060400@gmx.at> <50043C3D.7090201@gmx.at> <208B7D7BB4BC4339ADCC1166F76C1CD2@us.oracle.com> <500449B7.6070309@gmx.at> <023F63BCBF9442EBAEDCCE9D8A59E5E4@us.oracle.com> <5005354E.6040306@gmx.at> <62CF21F0010048E2BC1391192EB943FF@us.oracle.com> <5006E14B.3000407@gmx.at> <47731CC5C6EC4ED9AB9E9E05E259572C@us.oracle.com> <5007E47B.3050907@gmx.at> <446B437450EC47968D15C20D7142296B@us.oracle.com> <500A8C0E.4040006@gmx.at> <96A974694CF64567A3EAB85185AB3A5C@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1342946925 6421 80.91.229.3 (22 Jul 2012 08:48:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 22 Jul 2012 08:48:45 +0000 (UTC) Cc: 11939@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 22 10:48:44 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SsrqB-0004Zc-Sc for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Jul 2012 10:48:40 +0200 Original-Received: from localhost ([::1]:36237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsrqB-0006WV-84 for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Jul 2012 04:48:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ssrq9-0006WQ-06 for bug-gnu-emacs@gnu.org; Sun, 22 Jul 2012 04:48:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ssrq7-0002Xs-Nc for bug-gnu-emacs@gnu.org; Sun, 22 Jul 2012 04:48:36 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ssrq7-0002Xo-Jg for bug-gnu-emacs@gnu.org; Sun, 22 Jul 2012 04:48:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SsrwM-0001Ln-Is for bug-gnu-emacs@gnu.org; Sun, 22 Jul 2012 04:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Jul 2012 08:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11939-submit@debbugs.gnu.org id=B11939.13429472875170 (code B ref 11939); Sun, 22 Jul 2012 08:55:02 +0000 Original-Received: (at 11939) by debbugs.gnu.org; 22 Jul 2012 08:54:47 +0000 Original-Received: from localhost ([127.0.0.1]:56807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ssrw7-0001LL-6p for submit@debbugs.gnu.org; Sun, 22 Jul 2012 04:54:47 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:52709) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1Ssrw4-0001LB-B5 for 11939@debbugs.gnu.org; Sun, 22 Jul 2012 04:54:45 -0400 Original-Received: (qmail invoked by alias); 22 Jul 2012 08:48:15 -0000 Original-Received: from 62-47-34-6.adsl.highway.telekom.at (EHLO [62.47.34.6]) [62.47.34.6] by mail.gmx.net (mp070) with SMTP; 22 Jul 2012 10:48:15 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+mm2QRurmmSw2xFWyIQVayb55VEZN2joPOywpU27 /529s373z8fY65 In-Reply-To: <96A974694CF64567A3EAB85185AB3A5C@us.oracle.com> X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62262 Archived-At: >> > I imagine that your code is applicable only to Emacs 24+ >> > (is that right?), so it could not have >> > helped fix things with my setup for other Emacs versions. >> >> Yes. But maybe you could adapt your buffer display function >> accordingly. > > What do you mean? Write you own version of `special-display-popup-frame' replacing (let* ((frame (with-current-buffer buffer (make-frame (append args special-display-frame-alist)))) (window (frame-selected-window frame))) (display-buffer-record-window 'frame window buffer) (set-window-dedicated-p window t) with something like (let* ((frame (with-current-buffer buffer (make-frame (append args special-display-frame-alist)))) (window (frame-selected-window frame))) (with-selected-window window (redirect-frame-focus frame last-event-frame)) (display-buffer-record-window 'frame window buffer) (set-window-dedicated-p window t) where I used `last-event-frame' because you mentioned it. I'm not familiar with that variable. >> > What about other Emacs releases - are relevant at >> > all in this context? >> > Should we expect that your code can help them also? >> >> If you have an appropriate hook. > > Meaning? Is this something I can do (how)? The above should be applicable to earlier versions to. > (redirect-frame-focus last-event-frame > (window-frame (minibuffer-window))) > > Is that what you meant? Not really because I don't understand the semantics of `last-event-frame' well enough. But if it works, all the better. > That works, in all Emacs versions, even without your code! And so does using > this in its place: > > (select-frame-set-input-focus > (window-frame (minibuffer-window))) > > (Is there a difference? What is the advantage of either?) If you do this wrapped in a `with-selected-window' it should do the same as `redirect-frame-focus'. Otherwise, it will probably bring the frame into foreground. If `redirect-frame-focus' works, stay with it. > 1. When I do C-x C-c, and respond to the yes/no question, it seems I must wait a > tiny bit before typing yes/no. Otherwise, the first char (e.g. `y') is lost, so > I end up with just `es' (I see the `y' nowhere). Not a big deal; just FYI. Does this happen _only_ with your code or also in the emacs -Q scenarios _without_ your code? What happens with a `y-or-no-p' defalias? > 2. If I type "no," and then I do `C-x k', then even though *Process List* has > its frame border highlighted as if it is selected, the buffer proposed for > deletion is *shell*. OK, so I kill *shell*, and confirm ("yes') to kill its > processes also. (BTW, `C-x k' in my setup also deletes the window/frame.) So > far, so good. > > But if I try to use `C-x k' again to kill *Process List*, then, as soon as I hit > the `k': > > a. The default buffer to kill is proposed as some other buffer, not *Process > List* (in my setup the default value is automatically inserted in the > minibuffer, so I can see it without doing M-n). > > b. Emacs crashes, but gives no "fatal error" dialog box - hence no way to access > gdb. It just directly shows the MS Windows dialog box for sending an error > report to MS. When I click yes/no in that dialog box Emacs exits (disappears). Could be the abort in delete_frame I've told you about. Why don't you run Emacs in the debugger jsut from the beginning? (In a running instance of Emacs go to the src directory, type M-x gdb, give your full-path emacs.exe as argument, type "run" and do your things until the emacs fired up this way becomes unresponsive. A "bt full" in the first instance should tell you what happened.) > I can repro this systematically, but there seems to be no way to use gdb. If I > do something else instead of `C-x k' - e.g. `C-x o', then there is no problem. > I can, for instance, use `C-x o' to move among frames (`C-x o' moves to the > other frame in my setup, if there is no other window on the same frame), coming > eventually to *Process List*, and then use `C-x k' to kill *Process List*. > > This crash is reproducible also with Emacs 23.3, not just with the latest Emacs > 24 build. It does not happen with Emacs 22.3, however. Dunno whether this > crash is related to the crashes you are seeing. > > Anyway, it seems we are very close, for my needs. I suppose I can put that > redirection on `post-command-hook' (instead of in `1on1-fit-minibuffer-frame', > which some oneonone.el users will not use), and things should generally work. I > will try that next. That's a bad idea in my opinion. Redirect as soon as possible. Why don't you use `after-make-frame-functions'? martin