GNU bug report logs - #79487
emacs-31 TUI invisible childframe unexpectedly displayed in `with-selected-frame' body

Previous Next

Package: emacs;

Reported by: Pythonora Nybon <bmsac0001 <at> gmail.com>

Date: Mon, 22 Sep 2025 05:12:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

To reply to this bug, email your comments to 79487 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79487; Package emacs. (Mon, 22 Sep 2025 05:12:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pythonora Nybon <bmsac0001 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 22 Sep 2025 05:12:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pythonora Nybon <bmsac0001 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: emacs-31 TUI invisible childframe unexpectedly displayed in
 `with-selected-frame' body
Date: Mon, 22 Sep 2025 06:03:51 +0800
Dear emacs maintainers:

I found a strange bug (or maybe it's a feature?) in incoming emac-31
that an invisible TUI childframe may re-displayed under unexpected way
of when using =with-selected-frame=.

This bug's reproduction is very simple, that evaluate below code
snippet in vanilla emacs-31(currently in emacs-src git commit
27853a2bca6) with =-nw= in command line:

#+begin_src emacs-lisp :tangle yes
  (eval
   '(let ((win
           ;; first we just create a simple and fresh new childfarme
           (display-buffer-in-child-frame (generate-new-buffer "
*test-buffer* ") nil)))

      ;; then we make it invisible
      (make-frame-invisible (window-frame win))

      ;; then we scan all lived frames without doing any further operations
      ;; which may cause that childfarme displayed again.
      (dolist (el (frame-list))
        (with-selected-frame el nil))
      (message "See the prev-hided child-frame re-displayed without be
under our charge in lisp aspect.")
      ;; finally we finish the experiment
      (run-with-idle-timer
       5 nil
       (lambda (&rest _) (make-frame-invisible (window-frame win)))))
   'enable-lexical-binding)
#+end_src

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79487; Package emacs. (Mon, 22 Sep 2025 09:03:02 GMT) Full text and rfc822 format available.

Message #8 received at 79487 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Pythonora Nybon <bmsac0001 <at> gmail.com>, 79487 <at> debbugs.gnu.org
Subject: Re: bug#79487: emacs-31 TUI invisible childframe unexpectedly
 displayed in `with-selected-frame' body
Date: Mon, 22 Sep 2025 11:01:51 +0200
> I found a strange bug (or maybe it's a feature?) in incoming emac-31
> that an invisible TUI childframe may re-displayed under unexpected way
> of when using =with-selected-frame=.
>
> This bug's reproduction is very simple, that evaluate below code
> snippet in vanilla emacs-31(currently in emacs-src git commit
> 27853a2bca6) with =-nw= in command line:
>
> #+begin_src emacs-lisp :tangle yes
>    (eval
>     '(let ((win
>             ;; first we just create a simple and fresh new childfarme
>             (display-buffer-in-child-frame (generate-new-buffer "
> *test-buffer* ") nil)))
>
>        ;; then we make it invisible
>        (make-frame-invisible (window-frame win))
>
>        ;; then we scan all lived frames without doing any further operations
>        ;; which may cause that childfarme displayed again.
>        (dolist (el (frame-list))
>          (with-selected-frame el nil))
>        (message "See the prev-hided child-frame re-displayed without be
> under our charge in lisp aspect.")
>        ;; finally we finish the experiment
>        (run-with-idle-timer
>         5 nil
>         (lambda (&rest _) (make-frame-invisible (window-frame win)))))
>     'enable-lexical-binding)
> #+end_src

'with-selected-frame' calls 'select-frame' and the Elisp manual says:

     When using a text terminal, only one frame can be displayed at a time
  on the terminal, so after a call to ‘select-frame’, the next redisplay
  actually displays the newly selected frame.  This frame remains selected
  until a subsequent call to ‘select-frame’.

Eventually selecting another frame does not automatically make the
previously selected frame invisible, you have to do that manually as in
your snippet.

So this is neither a bug nor a feature.  It's how Emacs currently
behaves on TTYs and that behavior is not restricted to child frames
alone.  I'm not sure whether changing it is a good idea.  You can,
experimentally, change the

  if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))

line in do_switch_frame to

  if (false)

and use it until you run into troubles.  If you don't, we can make the
behavior optional, at least.

martin

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 11 Oct 2025 08:19:03 GMT) Full text and rfc822 format available.

Notification sent to Pythonora Nybon <bmsac0001 <at> gmail.com>:
bug acknowledged by developer. (Sat, 11 Oct 2025 08:19:03 GMT) Full text and rfc822 format available.

Message #13 received at 79487-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 79487-done <at> debbugs.gnu.org, bmsac0001 <at> gmail.com
Subject: Re: bug#79487: emacs-31 TUI invisible childframe unexpectedly
 displayed in `with-selected-frame' body
Date: Sat, 11 Oct 2025 11:17:44 +0300
> Date: Mon, 22 Sep 2025 11:01:51 +0200
> From:  martin rudalics via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
>  > I found a strange bug (or maybe it's a feature?) in incoming emac-31
>  > that an invisible TUI childframe may re-displayed under unexpected way
>  > of when using =with-selected-frame=.
>  >
>  > This bug's reproduction is very simple, that evaluate below code
>  > snippet in vanilla emacs-31(currently in emacs-src git commit
>  > 27853a2bca6) with =-nw= in command line:
>  >
>  > #+begin_src emacs-lisp :tangle yes
>  >    (eval
>  >     '(let ((win
>  >             ;; first we just create a simple and fresh new childfarme
>  >             (display-buffer-in-child-frame (generate-new-buffer "
>  > *test-buffer* ") nil)))
>  >
>  >        ;; then we make it invisible
>  >        (make-frame-invisible (window-frame win))
>  >
>  >        ;; then we scan all lived frames without doing any further operations
>  >        ;; which may cause that childfarme displayed again.
>  >        (dolist (el (frame-list))
>  >          (with-selected-frame el nil))
>  >        (message "See the prev-hided child-frame re-displayed without be
>  > under our charge in lisp aspect.")
>  >        ;; finally we finish the experiment
>  >        (run-with-idle-timer
>  >         5 nil
>  >         (lambda (&rest _) (make-frame-invisible (window-frame win)))))
>  >     'enable-lexical-binding)
>  > #+end_src
> 
> 'with-selected-frame' calls 'select-frame' and the Elisp manual says:
> 
>       When using a text terminal, only one frame can be displayed at a time
>    on the terminal, so after a call to ‘select-frame’, the next redisplay
>    actually displays the newly selected frame.  This frame remains selected
>    until a subsequent call to ‘select-frame’.
> 
> Eventually selecting another frame does not automatically make the
> previously selected frame invisible, you have to do that manually as in
> your snippet.
> 
> So this is neither a bug nor a feature.  It's how Emacs currently
> behaves on TTYs and that behavior is not restricted to child frames
> alone.  I'm not sure whether changing it is a good idea.  You can,
> experimentally, change the
> 
>    if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
> 
> line in do_switch_frame to
> 
>    if (false)
> 
> and use it until you run into troubles.  If you don't, we can make the
> behavior optional, at least.

No further comments within almost 3 weeks, so I'm now closing this
non-bug.




This bug report was last modified 26 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.