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'losesminibufferfocuswhenitcalls`list-processes' Date: Tue, 14 Aug 2012 11:10:38 +0200 Message-ID: <502A160E.5040601@gmx.at> References: <50165035.409040 1@gmx.at><501BAAB0.1020!807@gmx!.at><6461CCBF2903416 0B48D267E46D6FF0E@us.oracle.com><501D275D.3000701@gmx.at><7E4F337C7F6A4B8281!ABE6C82A8CA70E@us.ora cle.com><501FE2D4.1 050103@gmx.at><559D41024BC44EAC92C09DC14E1B7362@us.oracle.com><5022103E.6060502@gmx.at><72C02B3C324744308FB2DF605F46CCA3@us.oracle.com> <502378A8.90!10707@gmx.at> <5026266! 6.2060809@gmx.at> <502!785DF.1040200@gmx.at> <5028! A8FD.60705@gmx .at> < EE0A8E04D35647FE8CAAC52A84777A82@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 1344935497 2839 80.91.229.3 (14 Aug 2012 09:11:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 14 Aug 2012 09:11:37 +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 Tue Aug 14 11:11:36 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 1T1D9v-0006xb-Pr for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Aug 2012 11:11:32 +0200 Original-Received: from localhost ([::1]:43336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1D9u-00075f-JD for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Aug 2012 05:11:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1D9r-00075O-E3 for bug-gnu-emacs@gnu.org; Tue, 14 Aug 2012 05:11:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1D9p-0006AV-1k for bug-gnu-emacs@gnu.org; Tue, 14 Aug 2012 05:11:27 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1D9o-0006AR-UL for bug-gnu-emacs@gnu.org; Tue, 14 Aug 2012 05:11:24 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1T1DI9-0004qQ-OM for bug-gnu-emacs@gnu.org; Tue, 14 Aug 2012 05:20:01 -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: Tue, 14 Aug 2012 09:20:01 +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.134493594918542 (code B ref 11939); Tue, 14 Aug 2012 09:20:01 +0000 Original-Received: (at 11939) by debbugs.gnu.org; 14 Aug 2012 09:19:09 +0000 Original-Received: from localhost ([127.0.0.1]:55137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T1DHI-0004p0-LP for submit@debbugs.gnu.org; Tue, 14 Aug 2012 05:19:09 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:45509) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1T1DHG-0004ot-LB for 11939@debbugs.gnu.org; Tue, 14 Aug 2012 05:19:07 -0400 Original-Received: (qmail invoked by alias); 14 Aug 2012 09:10:28 -0000 Original-Received: from 62-47-49-255.adsl.highway.telekom.at (EHLO [62.47.49.255]) [62.47.49.255] by mail.gmx.net (mp024) with SMTP; 14 Aug 2012 11:10:28 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/klIN7s6jk/HQY5xdJrXHa6BWrKOM7QB3PbC1DAH hcWkf1DJr6b7bZ In-Reply-To: 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:63147 Archived-At: > It turns out that the problem was 3-fold. That is, there were three places in > the code of `1on1-fit-minibuffer-frame' that caused the problem: each was > _alone_ capable of causing the problem, so all three needed to be fixed. Here > they are. > > 1. This was one of the guards of the body of `1on1-fit-minibuffer-frame': > > (save-selected-window > (select-window (minibuffer-window)) > (one-window-p nil 'selected-frame)) Any reason why you don't use (one-window-p nil (window-frame (minibuffer-window))) here? > The call to `save-selected-window' somehow gave the focus to the *Completions* > frame. The solution was to change `save-selected-window' to > `save-window-excursion' here. I don't know why, but I'm hoping you will. You mean that `save-select-window' can redirect focus and not direct it back to where it was before calling it? If this is the case, please check whether it happens in Emacs 23 as well and file a bug report (without referencing `1on1-fit-minibuffer-frame', if possible). > 2. This was called near the beginning of the `1on1-fit-minibuffer-frame' body: > > (let* ((frame (save-selected-window > (select-window (minibuffer-window)) > (selected-frame))) Do you mean (window-frame (minibuffer-window)) here? > The fix here too was to use `save-window-excursion' instead of > `save-selected-window'. Same as above. > 3. At the end of the `1on1-fit-minibuffer-frame' body there is this call: > > (1on1-set-minibuffer-frame-top/bottom) > > The code for that function is this: > > (defun 1on1-set-minibuffer-frame-top/bottom () > (when 1on1-minibuffer-frame > (condition-case nil > (if (fboundp 'redisplay) > (redisplay t) > (force-mode-line-update t)) > (error nil)) ; Ignore errors from, e.g., killed buffers. > (modify-frame-parameters > 1on1-minibuffer-frame > `((top ,@ (or 1on1-minibuffer-frame-top/bottom > (- (* 2 (frame-char-height > 1on1-minibuffer-frame))))))))) > > Here the problem was the call to `redisplay'. I changed (foundp 'redisplay) to > just nil to fix things - `force-mode-line-update' works without changing the > focus. > > `redisplay' is defined in C code. I do not know why it causes a problem here > (why would redisplay change the input focus?), and I don't know what the proper > solution might be, except to just use `force-mode-line-update' as I was already > doing in older Emacs versions (which do not have `redisplay'). > > Do you have an idea about this? Does any of this make sense to you? No. Can't you distill a simple test case? `redisplay' shouldn't care about frame focus either. > Each of these fixes is needed for `1on1-fit-minibuffer-frame'. Reverting any of > them brings back the problem (giving *Completions* the focus). I do not > understand any of these fixes (why they work), and I am certainly not claiming > anything about them or about the problem, which I do not understand. I am only > saying that together these changes fix the problem I encountered. > > But if you can explain things I will be glad to learn. I can't explain any of these. In the past, I tried to make most window functions work on any window/frame to work independently from the selected window. Earlier, selecting a window must have been a very simple procedure. Nowadays, this incurs so many side-effects in the window/frame/display area that you should try to avoid `select-window' wherever possible. martin