unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: 13641@debbugs.gnu.org
Subject: bug#13641: 24.3.50; `minibuffer-inactive-mode' - hook seems wrong
Date: Wed, 6 Feb 2013 15:04:53 -0800	[thread overview]
Message-ID: <1FC09B5AA7D44DCDA241D3947B30BFA1@us.oracle.com> (raw)

I don't have the C sources, so cannot see just how/when
the hook `minibuffer-inactive-mode-hook' gets called.

I see this behavior with my own setup, which has a standalone minibuffer
frame: It seems like the hook is invoked for each toggle between
states active & inactive, i.e., including from inactive to active,
which would be wrong.  I would expect the hook to be invoked only
when the minibuffer becomes inactive.

E.g.:

(defun move-frame-right (&optional n frame)
  (interactive "p")
  (unless n (setq n  1))
  (setq n  (* n (frame-char-width frame)))
  (modify-frame-parameters frame
    (list (list 'left '+ (new-frame-position frame 'left n)))))

(add-hook 'minibuffer-inactive-mode-hook #'move-frame-right)

Start with the minibuffer inactive and some frame other than the
minibuffer frame selected, and do M-x.  That selected frame moves to the
right.  Why?  Then hit C-g to cancel M-x.  The minibuffer frame moves to
the right.

The latter makes sense, because C-g inactivates the minibuffer.  The
former invocation of the hook seems like a bug to me.

Then remove that hook function and do this instead:

Show buffer *Messages* in its own frame, then:
 
(add-hook 'minibuffer-inactive-mode-hook
 (lambda ()
   (message "fr: %S, active: %S"
            (selected-frame) (active-minibuffer-window))))
 
Then, with frame *Messages* selected, do M-x, then C-g.  This confirms
the double invocation.  This is what I see (my minibuffer frame has a
long name):
 
fr: #<frame *Messages* 03F9CC10>, active: #<window 6 on  *Minibuf-0*> [2 times]
fr: #<frame Emacs minibuffer - show/hide: hold CTRL + click in window 03FDDA48>,
active: nil
 
The first message, including the [2 times], appears after M-x.  The
second message appears after C-g.  Note that the first message indicates that
the minibuffer is _active_ - so why is the hook firing?
 
Now remove that hook function and then do this:
 
(add-hook 'minibuffer-inactive-mode-hook #'make-frame-invisible)
 
This is how I started.  I was expecting the minibuffer frame to
essentially stay hidden except when the minibuffer was activated.
 
With *Messages* selected, M-x makes *Messages* disappear.  Then C-g
makes the minibuffer frame disappear and brings back *Messages*.
 
Seems broken to me, but perhaps I'm missing something.
 
In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600)
 of 2013-01-30 on ODIEONE
Bzr revision: 111631 michael.albinus@gmx.de-20130130192046-nx4rskw7jemmtrw8
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -IC:/Devel/emacs/build/include --ldflags -LC:/Devel/emacs/build/lib'
 






             reply	other threads:[~2013-02-06 23:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06 23:04 Drew Adams [this message]
2013-02-06 23:55 ` bug#13641: 24.3.50; `minibuffer-inactive-mode' - hook seems wrong Drew Adams
2013-03-07  2:59   ` Drew Adams
2021-07-15  6:49 ` Lars Ingebrigtsen
2021-07-15  7:21   ` Eli Zaretskii
2021-07-15  7:26     ` Lars Ingebrigtsen
2021-08-12 15:16   ` Lars Ingebrigtsen

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=1FC09B5AA7D44DCDA241D3947B30BFA1@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=13641@debbugs.gnu.org \
    /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).