unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Drew Adams <drew.adams@oracle.com>
Cc: 11939@debbugs.gnu.org
Subject: bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus whenit	calls	`list-processes'
Date: Mon, 30 Jul 2012 11:13:21 +0200	[thread overview]
Message-ID: <50165031.50905@gmx.at> (raw)
In-Reply-To: <F930898D9C4E4DC295235DD8A4B7BFFE@us.oracle.com>

 > Here's the (current) issue and scenario.  It uses my setup (with untweaked
 > oneonone.el but also with the other libraries that I use).  The only thing I've
 > done differently than usual is to evaluate this sexp:
 >
 > (add-hook 'after-make-frame-functions
 >           (lambda (frame)
 >             (redirect-frame-focus frame
 >              (window-frame (minibuffer-window)))))
 >
 > I do M-x shell.
 > Then I do C-x C-c.
 >
 > The `yes-or-no-p' prompt about active processes appears in the minibuffer.  I
 > type "no" into the minibuffer.
 >
 > So far so good.  Things are perfectly normal now, and I am at top level (the
 > minibuffer has exited normally).
 >
 > I then do C-x k.
 >
 > Because my setup automatically inserts the default value (what `M-n' gives),

What does M-n do?

 > that buffer-name value is inserted in the minibuffer, waiting for me to hit RET
 > to accept it or to edit it and then hit RET.
 >
 > The default buffer name in this case is " *Minibuf-0*".  That is what I have
 > never seen before.  I.e., without adding that `add-hook' sexp (above), I do not
 > get this behavior.

I understand.  Then we have to look at the command M-n is bound to.

 > But I am not in any way trapped in the minibuffer.  I can edit the buffer name
 > to kill the buffer I want.  Or I can hit C-g.  And so on.

But, apparently, whatever you do, the current buffer is still *Minibuf-0*.

 > The only problem is that the value of `(current-buffer)' is " *Minibuf-0*" at
 > that point.  I know that by testing with `message' etc.  That is why I
 > hypothesized that something in that frame focus redirection caused the buffer "
 > *Minibuf-0*" to become selected, i.e., the `current-buffer'.
 >
 > But you corrected me, pointing out that `yes-or-no-p' does that: it selects the
 > minibuffer window/buffer.

Let me try to correct this again: `yes-or-no-p' selects the minibuffer
window.  `redirect-frame-focus' does not select any window.  I don't
know how this is related to your problem.

 > If I do not do the `add-hook', then I cannot type yes/no to the `yes-or-no-p'
 > prompt, without first manually selecting the minibuffer frame (e.g. by clicking
 > its titlebar).  And if I do that then the symptoms are the same as when I use
 > the `add-hook': after typing "no", if I use C-x k then " *Minibuf-0*" is the
 > default buffer to kill.

... where C-x k is not bound to `kill-buffer' but to another function ...

 > But if (I do not do the `add-hook' and) I do `M-: (yes-or-no-p "Foo? ")' and I
 > answer "no", then `C-x k' uses another buffer (the one selected before the M-:)
 > as the default value.  I am not sure why this difference, i.e., why
 > `yes-or-no-p' does not leave " *Minibuf-0*" as the current buffer in this case.
 > But it probably has to do with the execution of command `M-:' - IOW, in that
 > test it is not just `yes-or-no-p' that is involved, but also `M-:'.

`eval-expression' does consider the minibuffer window selected when it's
called from within the minibuffer.  Doing

C-h f

and then

C-: (selected-window) RET

will print the minibuffer window.

 > So perhaps this is only a problem with (because of) `yes-or-no-p'.  And perhaps
 > there is nothing that can (or should?) be done about it.  It is anyway a minor
 > problem compared to the general problem that this bug report is about: loss of
 > focus to the minibuffer frame.
 >
 > I hope we are now clear about this `C-x k' default-buffer problem.  Dunno what
 > can or should be done about it.  It seems (to me, so far) to be a problem with
 > `yes-or-no-p' (and perhaps some other functions?):
 >
 > In order to ask its question, `yes-or-no-p' not only redirects input focus to
 > the minibuffer but it also (apparently) selects the minibuffer's buffer.  And it
 > apparently leaves that buffer selected, as the `current-buffer'.
 >
 > You know better than I what, if anything could/should be done to correct this.
 > Should `yes-or-no-p' use `with-current-buffer' or something, so that it finishes
 > by selecting again the buffer that was selected when it started?  I'm guessing
 > yes, but I know nothing about the code.  It seems wrong that it should change
 > the selected buffer to the minibuffer and leave it so changed.

The code that does the selection and the restoration is in read_minibuf
which `yes-or-no-p' calls.  As explained earlier, I don't understand
that code well enough in order to tell what to change.

 > The above behavior description holds for all Emacs versions I have.  The
 > `add-hook' solves the unfocused minibuffer frame problem for all versions.
 >
 > That means also that for Emacs 24 I do not need to use the
 > `with-temp-buffer-window.el' code you sent.  It is sufficient to use the
 > `add-hook'.  Dunno whether that helps you decide something for Emacs 24.

The code has to work without any additional setup.

 > Given the info above, do you think that the equivalent of that `add-hook' should
 > perhaps be built into Emacs?  IOW, is some code correction in order, to do
 > systematically what the `add-hook' workaround accomplishes?

I don't know, unfortunately.

martin





  reply	other threads:[~2012-07-30  9:13 UTC|newest]

Thread overview: 147+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-13 18:00 bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus when it calls `list-processes' Drew Adams
2012-07-14 13:27 ` martin rudalics
2012-07-14 14:51   ` Drew Adams
2012-07-14 16:19     ` martin rudalics
2012-07-14 17:12       ` Drew Adams
2012-07-15 12:59         ` martin rudalics
2012-07-15 15:06           ` Drew Adams
2012-07-15 16:08             ` martin rudalics
2012-07-15 16:43               ` Drew Adams
2012-07-16  9:12                 ` martin rudalics
2012-07-16 14:23                   ` Drew Adams
2012-07-16 16:07                     ` martin rudalics
2012-07-16 16:36                       ` Drew Adams
2012-07-16 17:04                         ` martin rudalics
2012-07-16 18:22                           ` Drew Adams
2012-07-16 23:26                             ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus when itcalls `list-processes' Drew Adams
2012-07-17  9:50                               ` martin rudalics
2012-07-17 15:21                                 ` Drew Adams
2012-07-18 16:16                                   ` martin rudalics
2012-07-19  3:56                                     ` Drew Adams
2012-07-19 10:42                                       ` martin rudalics
2012-07-19 17:45                                         ` Drew Adams
2012-07-21 11:02                                           ` martin rudalics
2012-07-21 18:13                                             ` Drew Adams
2012-07-22  8:49                                               ` martin rudalics
     [not found]                                                 ` <ED063FDC2B7C4B2A9CB2BDADAE2F00A2@us.orac! ! le.com>
2012-07-22 16:55                                                 ` Drew Adams
2012-07-23  9:34                                                   ` martin rudalics
2012-07-23 16:12                                                     ` Drew Adams
2012-07-17  9:50                             ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus when it calls `list-processes' martin rudalics
2012-07-17 14:22                               ` Drew Adams
2012-07-18 16:16                                 ` martin rudalics
2012-07-18 17:23                                   ` Drew Adams
2012-07-19 10:41                                     ` martin rudalics
2012-07-19 17:43                                       ` Drew Adams
2012-07-21 11:01                                         ` martin rudalics
2012-07-21 18:13                                           ` Drew Adams
2012-07-19  3:54                                   ` Drew Adams
2012-07-19 10:42                                     ` martin rudalics
2012-07-19 17:43                                       ` Drew Adams
2012-07-21 11:01                                         ` martin rudalics
2012-07-21 18:13                                           ` Drew Adams
2012-07-22  8:48                                             ` martin rudalics
2012-07-22 16:46                                               ` Drew Adams
2012-07-22 17:06                                                 ` Eli Zaretskii
     [not found]                                                   ` <8C! 6D5530BE0@[87.69.210.75! ]>
     [not found]                                                   ` <83! 4n@[87.69.210.75]>
2012-07-22 19:42                                                   ` Drew Adams
2012-07-22 20:49                                                     ` Eli Zaretskii
2012-07-22 21:01                                                       ` Drew Adams
2012-07-22 21:07                                                         ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus whenit " Drew Adams
2012-07-22 21:21                                                           ` Daniel Colascione
2012-07-23  1:13                                                             ` Drew Adams
2012-07-22 21:16                                                         ` Drew Adams
2012-07-23 17:33                                                           ` Eli Zaretskii
2012-07-23 18:00                                                             ` Drew Adams
2012-07-23 16:04                                                         ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus when it " Eli Zaretskii
2012-07-23 16:28                                                           ` Drew Adams
2012-07-23 17:58                                                             ` Eli Zaretskii
2012-07-23 18:29                                                               ` Drew Adams
2012-07-23 19:30                                                                 ` Eli Zaretskii
2012-07-24 12:47                                                                   ` martin rudalics
2012-07-25 15:42                                                                     ` Drew Adams
2012-07-25 16:17                                                                       ` Eli Zaretskii
2012-07-25 16:42                                                                         ` Drew Adams
2012-07-25 17:28                                                                           ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus whenit " Drew Adams
2012-07-26  9:44                                                                             ` martin rudalics
     [not found]                                                                               ` <32A934E820BA4853B84229C32F7145A1@us.oracle! ! .com>
2012-07-26 13:51                                                                               ` Drew Adams
2012-07-26 16:05                                                                                 ` martin rudalics
2012-07-26 16:21                                                                                   ` Drew Adams
2012-07-26 16:52                                                                                     ` martin rudalics
     [not found]                                                                                       ` <2F76545DBD0C4F199A60F4! B750709112@us.oracle.com>
     [not found]                                                                                         ` <FBD01B85621E4CB5AF89A744D72DA935@us.oracle.! ! com>
2012-07-26 17:08                                                                                       ` Drew Adams
2012-07-26 17:41                                                                                         ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focuswhenit " Drew Adams
2012-07-27  6:33                                                                                           ` martin rudalics
2012-07-28 15:29                                                                                             ` Drew Adams
2012-07-29 13:56                                                                                               ` martin rudalics
2012-07-28 15:31                                                                                             ` Drew Adams
2012-07-29 13:56                                                                                               ` martin rudalics
2012-07-27  6:33                                                                                         ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus whenit " martin rudalics
2012-07-28 15:29                                                                                           ` Drew Adams
2012-07-29 13:55                                                                                             ` martin rudalics
2012-07-29 16:26                                                                                               ` Drew Adams
2012-07-29 17:08                                                                                                 ` martin rudalics
     [not found]                                                                                                   ` <F930898D9C4E4DC295235DD8! A4B7BFFE@us.oracle.com>
     [not found]                                                                                                     ` <F1206E98AF6C40E8BBDD20894A9BC0D2@us.oracle.co! ! m>
     [not found]                                                                                                   ` <F930898D9C4E4DC295235DD8!A4B7BFFE@us.oracle.com>
2012-07-29 18:01                                                                                                   ` Drew Adams
2012-07-30  9:13                                                                                                     ` martin rudalics [this message]
2012-08-01 16:34                                                                                                       ` Drew Adams
     [not found]                                                                                                   ` <F930898D9C4E4DC295235DD8! A4B7BFFE@us.oracle.co m>
2012-07-29 19:26                                                                                                     ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focuswhenit " Drew Adams
2012-07-30  9:13                                                                                                       ` martin rudalics
2012-08-01 16:34                                                                                                         ` Drew Adams
     [not found]                                                                                                           ` <501BAAB0.1020!807@gmx! .at>
2012-08-03 10:40                                                                                                           ` martin rudalics
2012-08-03 16:46                                                                                                             ` Drew Adams
2012-08-03 17:00                                                                                                               ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focuswhenitcalls `list-processes' Drew Adams
2012-08-04 13:45                                                                                                                 ` martin rudalics
     [not found]                                                                                                                   ` <7E4F337C7F6A4B8281! ABE6C82A8CA70E@us.oracle.com>
     [not found]                                                                                                                     ` <B7E92FDE8CFC4F798AEEB7CBFEFA933D@us.orac! ! le.com>
     [not found]                                                                                                                   ` <7E4F337C7F6A4B8281!ABE6C82 A8CA70E@us.oracle.com>
2012-08-05 22:32                                                                                                                   ` Drew Adams
2012-08-05 23:10                                                                                                                     ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focuswhenitcalls`list-processes' Drew Adams
2012-08-06 15:29                                                                                                                       ` martin rudalics
2012-08-06 20:56                                                                                                                         ` Drew Adams
     [not found]                                                                                                                           ` < 5022103E.6060502@gmx.at>
2012-08-07  8:58                                                                                                                           ` martin rudalics
2012-08-08  7:07                                                                                                                           ` martin rudalics
2012-08-08 16:19                                                                                                                             ` Drew Adams
2012-08-08 16:32                                                                                                                               ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibufferfocuswhenitcalls`list-processes' Drew Adams
2012-08-08 16:38                                                                                                                                 ` bug#11939: 24.1; `save-buffers-kill-emacs' losesminibufferfocuswhenitcalls`list-processes' Drew Adams
2012-08-09  8:45                                                                                                                                   ` martin rudalics
2012-08-10 17:47                                                                                                                                     ` Drew Adams
2012-08-11  9:31                                                                                                                                       ` martin rudalics
2012-08-11 16:58                                                                                                                                         ` Drew Adams
     [not found]                                                                                                                                           ` <502! 785DF.1040200@gmx.at>
     [not found]                                                                                                                                             ` <A5E13547EC48444192A20752F3F4FAF9@us.oracle.com! >
     [not found]                                                                                                                                           ` <502!785DF.1040200@gmx.at>
     [not found]                                                                                                                                             ` <A5E13547EC48444192A20752F3F4FAF9@us.oracle.com!>
     [not found]                                                                                                                                               ` <5028! A8FD.60705@gmx .at>
2012-08-12 10:30                                                                                                                                           ` martin rudalics
2012-08-12 15:03                                                                                                                                             ` Drew Adams
2012-08-13  7:13                                                                                                                                               ` martin rudalics
2012-08-13 13:51                                                                                                                                                 ` Drew Adams
2012-08-13 16:23                                                                                                                                                   ` martin rudalics
2012-08-13 22:20                                                                                                                                                   ` bug#11939: 24.1; `save-buffers-kill-emacs'losesminibufferfocuswhenitcalls`list-processes' Drew Adams
2012-08-14  9:10                                                                                                                                                     ` martin rudalics
2012-08-14 14:36                                                                                                                                                       ` Drew Adams
2012-08-14 16:04                                                                                                                                                         ` martin rudalics
2012-08-14 17:39                                                                                                                                                           ` Drew Adams
     [not found]                                                                                                                                                             ` <502B7AC2.70! 004@gmx. at>
2012-08-15 10:32                                                                                                                                                             ` martin rudalics
2012-08-26  4:11                                                                                                                                                               ` Drew Adams
2012-08-26  4:31                                                                                                                                                                 ` Drew Adams
2012-08-09  8:45                                                                                                                                 ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibufferfocuswhenitcalls`list-processes' martin rudalics
2012-08-09 21:53                                                                                                                                   ` Drew Adams
2012-08-10  9:33                                                                                                                                     ` martin rudalics
2012-08-09  8:44                                                                                                                               ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focuswhenitcalls`list-processes' martin rudalics
2012-08-09 21:53                                                                                                                                 ` Drew Adams
2012-08-06 15:29                                                                                                                     ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focuswhenitcalls `list-processes' martin rudalics
2012-08-06 20:55                                                                                                                       ` Drew Adams
2012-08-07  8:58                                                                                                                         ` martin rudalics
2012-08-07 13:39                                                                                                                           ` Drew Adams
2012-08-04 13:44                                                                                                               ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focuswhenit calls `list-processes' martin rudalics
2012-08-06  1:11                                                                                                                 ` Drew Adams
2012-08-06 15:29                                                                                                                   ` martin rudalics
2012-08-06 21:05                                                                                                                     ` Drew Adams
     [not found]                                                                                                                       ` <50! 20D8B6.5000701@gmx.at>
     [not found]                                                                                                                         ` <254E2E4A521F4250A06349AD44BEEE63@us.oracle.co! ! m>
2012-08-07  8:58                                                                                                                       ` martin rudalics
2012-08-07 13:59                                                                                                                         ` Drew Adams
2012-08-08  7:07                                                                                                                           ` martin rudalics
     [not found]                                                                                                                             ` <E0132113E8CD4470A74D81C04D74585C@us.orac! ! le.com>
2012-08-08 16:18                                                                                                                             ` Drew Adams
2012-08-09  8:44                                                                                                                               ` martin rudalics
2012-08-09 21:54                                                                                                                                 ` Drew Adams
2012-07-26 15:48                                                                           ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus when it " martin rudalics
2012-07-26 15:52                                                                             ` Drew Adams
2012-07-23  9:34                                                 ` martin rudalics
2012-07-23 16:12                                                   ` Drew Adams
2012-07-24 12:46                                                     ` martin rudalics
2012-07-25 15:02                                                       ` Drew Adams
2012-07-26  9:43                                                         ` martin rudalics
2012-07-16 14:52                   ` Drew Adams
2012-09-05 14:30 ` martin rudalics
2012-09-05 14:35   ` Drew Adams
2012-10-03 16:18     ` bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus when itcalls `list-processes' Drew Adams
2012-10-05  7:04       ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50165031.50905@gmx.at \
    --to=rudalics@gmx.at \
    --cc=11939@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).