unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13641: 24.3.50; `minibuffer-inactive-mode' - hook seems wrong
@ 2013-02-06 23:04 Drew Adams
  2013-02-06 23:55 ` Drew Adams
  2021-07-15  6:49 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Drew Adams @ 2013-02-06 23:04 UTC (permalink / raw)
  To: 13641

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'
 






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-12 15:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-06 23:04 bug#13641: 24.3.50; `minibuffer-inactive-mode' - hook seems wrong Drew Adams
2013-02-06 23:55 ` 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

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).