all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Question about üarent-frame changes
@ 2024-09-18 10:58 Gerd Möllmann
  2024-09-18 14:15 ` martin rudalics
  0 siblings, 1 reply; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-18 10:58 UTC (permalink / raw)
  To: Martin Rudalics; +Cc: Emacs Devel

Hi Martin,

I came across another question today. Maybe you can help me with this.
It's actually not very technical, more a question if and how something
is used today, or how important it is supporting it on ttys.

I'm talking about changing the parent-frame of a frame.

AFAICT from the Elisp Info docs, one is currently free to change the
parent-frame as one sees fit. That is, one can make a child a root
frame, a root frame a child, or change the parent of a child to another
root.

I'm currently inclined to disallow parent-frame changes on ttys
entirely, unless it is used for something. Couldn't find something
today, but maybe something is a package outside Emacs' repo, or I'm just
ont looking for the right thing.

WDYT?




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

* Re: Question about üarent-frame changes
  2024-09-18 10:58 Question about üarent-frame changes Gerd Möllmann
@ 2024-09-18 14:15 ` martin rudalics
  2024-09-18 14:24   ` Ship Mints
                     ` (3 more replies)
  0 siblings, 4 replies; 35+ messages in thread
From: martin rudalics @ 2024-09-18 14:15 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: Emacs Devel

 > AFAICT from the Elisp Info docs, one is currently free to change the
 > parent-frame as one sees fit. That is, one can make a child a root
 > frame, a root frame a child, or change the parent of a child to another
 > root.
 >
 > I'm currently inclined to disallow parent-frame changes on ttys
 > entirely, unless it is used for something. Couldn't find something
 > today, but maybe something is a package outside Emacs' repo, or I'm just
 > ont looking for the right thing.

I'm not aware of people using multiple frames on TTYs and I have no idea
whether child frames out there are even intended to be reparented.

Reparenting is useful because you can set up one child frame for some
special purpose, make it invisible when you don't need it, and move it
to another frame and make it visible there whenever you want to.  On
GUIs, this approach has the advantage that you can avoid the (at least
here) costly process of setting up frame faces every time anew.  Emacs
tooltips do that by default and I recall that showing a tooltip every
time incurred two entire GC cycles here.

martin



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

* Re: Question about üarent-frame changes
  2024-09-18 14:15 ` martin rudalics
@ 2024-09-18 14:24   ` Ship Mints
  2024-09-18 18:51     ` martin rudalics
  2024-09-18 14:26   ` Robert Pluim
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 35+ messages in thread
From: Ship Mints @ 2024-09-18 14:24 UTC (permalink / raw)
  To: martin rudalics; +Cc: Gerd Möllmann, Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]

I use multiple frames on tty just as I do with a  window system. Switching
among frames works the same and tab-bar works the same. Try it like this.
Start your emacs, C-x 5 n, M-x select-frame-by-name and you'll see two
frames.

On Wed, Sep 18, 2024 at 10:16 AM martin rudalics <rudalics@gmx.at> wrote:

>  > AFAICT from the Elisp Info docs, one is currently free to change the
>  > parent-frame as one sees fit. That is, one can make a child a root
>  > frame, a root frame a child, or change the parent of a child to another
>  > root.
>  >
>  > I'm currently inclined to disallow parent-frame changes on ttys
>  > entirely, unless it is used for something. Couldn't find something
>  > today, but maybe something is a package outside Emacs' repo, or I'm just
>  > ont looking for the right thing.
>
> I'm not aware of people using multiple frames on TTYs and I have no idea
> whether child frames out there are even intended to be reparented.
>
> Reparenting is useful because you can set up one child frame for some
> special purpose, make it invisible when you don't need it, and move it
> to another frame and make it visible there whenever you want to.  On
> GUIs, this approach has the advantage that you can avoid the (at least
> here) costly process of setting up frame faces every time anew.  Emacs
> tooltips do that by default and I recall that showing a tooltip every
> time incurred two entire GC cycles here.
>
> martin
>
>

[-- Attachment #2: Type: text/html, Size: 1918 bytes --]

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

* Re: Question about üarent-frame changes
  2024-09-18 14:15 ` martin rudalics
  2024-09-18 14:24   ` Ship Mints
@ 2024-09-18 14:26   ` Robert Pluim
  2024-09-18 14:30     ` Ship Mints
                       ` (2 more replies)
  2024-09-18 15:03   ` Gerd Möllmann
  2024-09-18 16:15   ` Eli Zaretskii
  3 siblings, 3 replies; 35+ messages in thread
From: Robert Pluim @ 2024-09-18 14:26 UTC (permalink / raw)
  To: martin rudalics; +Cc: Gerd Möllmann, Emacs Devel

>>>>> On Wed, 18 Sep 2024 16:15:56 +0200, martin rudalics <rudalics@gmx.at> said:

    >> AFAICT from the Elisp Info docs, one is currently free to change the
    >> parent-frame as one sees fit. That is, one can make a child a root
    >> frame, a root frame a child, or change the parent of a child to another
    >> root.
    >> 
    >> I'm currently inclined to disallow parent-frame changes on ttys
    >> entirely, unless it is used for something. Couldn't find something
    >> today, but maybe something is a package outside Emacs' repo, or I'm just
    >> ont looking for the right thing.

    martin> I'm not aware of people using multiple frames on TTYs and I have no idea
    martin> whether child frames out there are even intended to be reparented.

I do it all the time. But obviously they each occupy the full
terminal.

    martin> Reparenting is useful because you can set up one child frame for some
    martin> special purpose, make it invisible when you don't need it, and move it
    martin> to another frame and make it visible there whenever you want to.  On
    martin> GUIs, this approach has the advantage that you can avoid the (at least
    martin> here) costly process of setting up frame faces every time anew.  Emacs
    martin> tooltips do that by default and I recall that showing a tooltip every
    martin> time incurred two entire GC cycles here.

Would setting up frame faces be that expensive on tty? Iʼd really love
to have tty child frames, even if they were not blazingly fast.

In any case, I took a quick look at "posframe", it doesnʼt do any
reparenting that I can see.

Robert
-- 



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

* Re: Question about üarent-frame changes
  2024-09-18 14:26   ` Robert Pluim
@ 2024-09-18 14:30     ` Ship Mints
  2024-09-18 15:26       ` Gerd Möllmann
  2024-09-18 15:22     ` Gerd Möllmann
  2024-09-18 18:51     ` martin rudalics
  2 siblings, 1 reply; 35+ messages in thread
From: Ship Mints @ 2024-09-18 14:30 UTC (permalink / raw)
  To: Robert Pluim; +Cc: martin rudalics, Gerd Möllmann, Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 1958 bytes --]

Daniel Mendler's corfu at-point completion package works on tty with child
frames, as an example to take a look at.

On Wed, Sep 18, 2024 at 10:27 AM Robert Pluim <rpluim@gmail.com> wrote:

> >>>>> On Wed, 18 Sep 2024 16:15:56 +0200, martin rudalics <rudalics@gmx.at>
> said:
>
>     >> AFAICT from the Elisp Info docs, one is currently free to change the
>     >> parent-frame as one sees fit. That is, one can make a child a root
>     >> frame, a root frame a child, or change the parent of a child to
> another
>     >> root.
>     >>
>     >> I'm currently inclined to disallow parent-frame changes on ttys
>     >> entirely, unless it is used for something. Couldn't find something
>     >> today, but maybe something is a package outside Emacs' repo, or I'm
> just
>     >> ont looking for the right thing.
>
>     martin> I'm not aware of people using multiple frames on TTYs and I
> have no idea
>     martin> whether child frames out there are even intended to be
> reparented.
>
> I do it all the time. But obviously they each occupy the full
> terminal.
>
>     martin> Reparenting is useful because you can set up one child frame
> for some
>     martin> special purpose, make it invisible when you don't need it, and
> move it
>     martin> to another frame and make it visible there whenever you want
> to.  On
>     martin> GUIs, this approach has the advantage that you can avoid the
> (at least
>     martin> here) costly process of setting up frame faces every time
> anew.  Emacs
>     martin> tooltips do that by default and I recall that showing a
> tooltip every
>     martin> time incurred two entire GC cycles here.
>
> Would setting up frame faces be that expensive on tty? Iʼd really love
> to have tty child frames, even if they were not blazingly fast.
>
> In any case, I took a quick look at "posframe", it doesnʼt do any
> reparenting that I can see.
>
> Robert
> --
>
>

[-- Attachment #2: Type: text/html, Size: 2567 bytes --]

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

* Re: Question about üarent-frame changes
  2024-09-18 14:15 ` martin rudalics
  2024-09-18 14:24   ` Ship Mints
  2024-09-18 14:26   ` Robert Pluim
@ 2024-09-18 15:03   ` Gerd Möllmann
  2024-09-18 16:14     ` Eli Zaretskii
  2024-09-18 16:15   ` Eli Zaretskii
  3 siblings, 1 reply; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-18 15:03 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

martin rudalics <rudalics@gmx.at> writes:

>> AFAICT from the Elisp Info docs, one is currently free to change the
>> parent-frame as one sees fit. That is, one can make a child a root
>> frame, a root frame a child, or change the parent of a child to another
>> root.
>>
>> I'm currently inclined to disallow parent-frame changes on ttys
>> entirely, unless it is used for something. Couldn't find something
>> today, but maybe something is a package outside Emacs' repo, or I'm just
>> ont looking for the right thing.
>
> I'm not aware of people using multiple frames on TTYs and I have no idea
> whether child frames out there are even intended to be reparented.

Ok, thanks. I'm using mulitple frames sometimes, but in the end seem to
99% end up using tabs (C-x t 2 etc), like on GUI.

> Reparenting is useful because you can set up one child frame for some
> special purpose, make it invisible when you don't need it, and move it
> to another frame and make it visible there whenever you want to.  On
> GUIs, this approach has the advantage that you can avoid the (at least
> here) costly process of setting up frame faces every time anew.  

Hm, that might indeed be an interesting optimization.

> Emacs tooltips do that by default and I recall that showing a tooltip
> every time incurred two entire GC cycles here.

(Oh, hadn't thought of tooltips on ttys yet. New entry in my list :-).)

So I guess I'll keep at least the option of re-parenting child frames to
another root frame open, until I know more about how fast that all
turns out to be. If I had to guess, face realization on ttys could well
be faster than on GUIs because all the font stuff doesn't have to be
done.

But I'll disable to root <-> child transformation. That feels abit
esoteric.

Thanks!



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

* Re: Question about üarent-frame changes
  2024-09-18 14:26   ` Robert Pluim
  2024-09-18 14:30     ` Ship Mints
@ 2024-09-18 15:22     ` Gerd Möllmann
  2024-09-18 18:51     ` martin rudalics
  2 siblings, 0 replies; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-18 15:22 UTC (permalink / raw)
  To: Robert Pluim; +Cc: martin rudalics, Emacs Devel

Robert Pluim <rpluim@gmail.com> writes:

>     martin> Reparenting is useful because you can set up one child frame for some
>     martin> special purpose, make it invisible when you don't need it, and move it
>     martin> to another frame and make it visible there whenever you want to.  On
>     martin> GUIs, this approach has the advantage that you can avoid the (at least
>     martin> here) costly process of setting up frame faces every time anew.  Emacs
>     martin> tooltips do that by default and I recall that showing a tooltip every
>     martin> time incurred two entire GC cycles here.
>
> Would setting up frame faces be that expensive on tty? Iʼd really love
> to have tty child frames, even if they were not blazingly fast.

From what I've seen so far, it's pretty fast, but OTOH my machine is
pretty fast (M1 pro). Let's see how it does when I'm a bit further. At
least hiding frames on ttys should be there before I can really try it
with posframe. Maybe also moving/resizing also.

> In any case, I took a quick look at "posframe", it doesnʼt do any
> reparenting that I can see.

Thanks! Corfu doesn't re-parent either, AFAICT. That are the two I care
about :-).



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

* Re: Question about üarent-frame changes
  2024-09-18 14:30     ` Ship Mints
@ 2024-09-18 15:26       ` Gerd Möllmann
  2024-09-18 15:32         ` Ship Mints
  0 siblings, 1 reply; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-18 15:26 UTC (permalink / raw)
  To: Ship Mints; +Cc: Robert Pluim, martin rudalics, Emacs Devel

Ship Mints <shipmints@gmail.com> writes:

> Daniel Mendler's corfu at-point completion package works on tty with
> child frames, as an example to take a look at.

Do you mean corfu-terminal? That's a clever workaround for the
non-existence of child frames on ttys using overlays and display
properties IIRC. It can't really replace child frames, though.



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

* Re: Question about üarent-frame changes
  2024-09-18 15:26       ` Gerd Möllmann
@ 2024-09-18 15:32         ` Ship Mints
  0 siblings, 0 replies; 35+ messages in thread
From: Ship Mints @ 2024-09-18 15:32 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: Robert Pluim, martin rudalics, Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]

Yes, sorry, corfu-terminal when in tty mode.

On Wed, Sep 18, 2024 at 11:26 AM Gerd Möllmann <gerd.moellmann@gmail.com>
wrote:

> Ship Mints <shipmints@gmail.com> writes:
>
> > Daniel Mendler's corfu at-point completion package works on tty with
> > child frames, as an example to take a look at.
>
> Do you mean corfu-terminal? That's a clever workaround for the
> non-existence of child frames on ttys using overlays and display
> properties IIRC. It can't really replace child frames, though.
>

[-- Attachment #2: Type: text/html, Size: 953 bytes --]

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

* Re: Question about üarent-frame changes
  2024-09-18 15:03   ` Gerd Möllmann
@ 2024-09-18 16:14     ` Eli Zaretskii
  2024-09-18 16:42       ` Gerd Möllmann
  0 siblings, 1 reply; 35+ messages in thread
From: Eli Zaretskii @ 2024-09-18 16:14 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: rudalics, emacs-devel

> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Cc: Emacs Devel <emacs-devel@gnu.org>
> Date: Wed, 18 Sep 2024 17:03:34 +0200
> 
> martin rudalics <rudalics@gmx.at> writes:
> 
> > Emacs tooltips do that by default and I recall that showing a tooltip
> > every time incurred two entire GC cycles here.
> 
> (Oh, hadn't thought of tooltips on ttys yet. New entry in my list :-).)

Tooltips on ttys are shown in the echo-area.



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

* Re: Question about üarent-frame changes
  2024-09-18 14:15 ` martin rudalics
                     ` (2 preceding siblings ...)
  2024-09-18 15:03   ` Gerd Möllmann
@ 2024-09-18 16:15   ` Eli Zaretskii
  2024-09-18 18:52     ` martin rudalics
  3 siblings, 1 reply; 35+ messages in thread
From: Eli Zaretskii @ 2024-09-18 16:15 UTC (permalink / raw)
  To: martin rudalics; +Cc: gerd.moellmann, emacs-devel

> Date: Wed, 18 Sep 2024 16:15:56 +0200
> Cc: Emacs Devel <emacs-devel@gnu.org>
> From: martin rudalics <rudalics@gmx.at>
> 
> I'm not aware of people using multiple frames on TTYs and I have no idea
> whether child frames out there are even intended to be reparented.
> 
> Reparenting is useful because you can set up one child frame for some
> special purpose, make it invisible when you don't need it, and move it
> to another frame and make it visible there whenever you want to.  On
> GUIs, this approach has the advantage that you can avoid the (at least
> here) costly process of setting up frame faces every time anew.  Emacs
> tooltips do that by default and I recall that showing a tooltip every
> time incurred two entire GC cycles here.

What you describe makes sens for GUI frames, but seems to make little
sense for TTY frames, because frame visibility situation there is much
simpler.



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

* Re: Question about üarent-frame changes
  2024-09-18 16:14     ` Eli Zaretskii
@ 2024-09-18 16:42       ` Gerd Möllmann
  0 siblings, 0 replies; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-18 16:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rudalics, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: Emacs Devel <emacs-devel@gnu.org>
>> Date: Wed, 18 Sep 2024 17:03:34 +0200
>> 
>> martin rudalics <rudalics@gmx.at> writes:
>> 
>> > Emacs tooltips do that by default and I recall that showing a tooltip
>> > every time incurred two entire GC cycles here.
>> 
>> (Oh, hadn't thought of tooltips on ttys yet. New entry in my list :-).)
>
> Tooltips on ttys are shown in the echo-area.

Yes, because I didn't have child frames back then :-).



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

* Re: Question about üarent-frame changes
  2024-09-18 14:24   ` Ship Mints
@ 2024-09-18 18:51     ` martin rudalics
  2024-09-19  5:01       ` Eli Zaretskii
  0 siblings, 1 reply; 35+ messages in thread
From: martin rudalics @ 2024-09-18 18:51 UTC (permalink / raw)
  To: Ship Mints; +Cc: Gerd Möllmann, Emacs Devel

 > I use multiple frames on tty just as I do with a  window system. Switching
 > among frames works the same and tab-bar works the same. Try it like this.
 > Start your emacs, C-x 5 n, M-x select-frame-by-name and you'll see two
 > frames.

But not simultaneously.  Still it's good to know that people do use
multiple frames on TTYs.

Thanks, martin



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

* Re: Question about üarent-frame changes
  2024-09-18 14:26   ` Robert Pluim
  2024-09-18 14:30     ` Ship Mints
  2024-09-18 15:22     ` Gerd Möllmann
@ 2024-09-18 18:51     ` martin rudalics
  2 siblings, 0 replies; 35+ messages in thread
From: martin rudalics @ 2024-09-18 18:51 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Gerd Möllmann, Emacs Devel

 > Would setting up frame faces be that expensive on tty?

It should be much cheaper than on a graphics display because there
are less faces and colors.

 > Iʼd really love
 > to have tty child frames, even if they were not blazingly fast.

The key point is to make switching their visibility status reasonably
fast.

martin

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

* Re: Question about üarent-frame changes
  2024-09-18 16:15   ` Eli Zaretskii
@ 2024-09-18 18:52     ` martin rudalics
  2024-09-19  0:33       ` Po Lu
                         ` (2 more replies)
  0 siblings, 3 replies; 35+ messages in thread
From: martin rudalics @ 2024-09-18 18:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gerd.moellmann, emacs-devel

 > What you describe makes sens for GUI frames, but seems to make little
 > sense for TTY frames, because frame visibility situation there is much
 > simpler.

You mean because only one normal frame can be visible at any time.
However, child frames complicate the situation considerably because
Emacs itself has to take care of their visibility instead of the WM.

For example, I can type into a GUI window text beneath a (small) child
frame as long as that child frame doesn't have focus.  Emulating such
behavior with text emanating at the right of the child frame on a TTY
seems tricky at least.

martin



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

* Re: Question about üarent-frame changes
  2024-09-18 18:52     ` martin rudalics
@ 2024-09-19  0:33       ` Po Lu
  2024-09-19  8:08         ` martin rudalics
  2024-09-19  4:29       ` Gerd Möllmann
  2024-09-19  4:58       ` Eli Zaretskii
  2 siblings, 1 reply; 35+ messages in thread
From: Po Lu @ 2024-09-19  0:33 UTC (permalink / raw)
  To: martin rudalics; +Cc: Eli Zaretskii, gerd.moellmann, emacs-devel

martin rudalics <rudalics@gmx.at> writes:

>> What you describe makes sens for GUI frames, but seems to make little
>> sense for TTY frames, because frame visibility situation there is much
>> simpler.
>
> You mean because only one normal frame can be visible at any time.
> However, child frames complicate the situation considerably because
> Emacs itself has to take care of their visibility instead of the WM.
>
> For example, I can type into a GUI window text beneath a (small) child
> frame as long as that child frame doesn't have focus.  Emulating such
> behavior with text emanating at the right of the child frame on a TTY
> seems tricky at least.
>
> martin

Most of the extant popup packages that exercise child frames also retain
and reparent them across different parents, and as such, Gerd will need
to implement reparenting.



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

* Re: Question about üarent-frame changes
  2024-09-18 18:52     ` martin rudalics
  2024-09-19  0:33       ` Po Lu
@ 2024-09-19  4:29       ` Gerd Möllmann
  2024-09-19  8:09         ` martin rudalics
  2024-09-19  4:58       ` Eli Zaretskii
  2 siblings, 1 reply; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-19  4:29 UTC (permalink / raw)
  To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel

martin rudalics <rudalics@gmx.at> writes:

>> What you describe makes sens for GUI frames, but seems to make little
>> sense for TTY frames, because frame visibility situation there is much
>> simpler.
>
> You mean because only one normal frame can be visible at any time.
> However, child frames complicate the situation considerably because
> Emacs itself has to take care of their visibility instead of the WM.

Yes, that's true but I think I have that, at least in principle.

The biggest problem for me in this area today is that "visibility" on
GUIs and ttys apparently is not the same thing. For example,
make-frame-visible seems to do nothing for tty frames. So I guess all
tty frames are always visible in the sense that frame::visible is
non-zero.

But that would be too easy of course, which is why frame::visible has 2
bits, and if the second bit is set the frame is "obscured" (happens with
C-x 5 2), which I'd call sort of invisible because it can't be seen but
that's of course naive.

Grumpy.



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

* Re: Question about üarent-frame changes
  2024-09-18 18:52     ` martin rudalics
  2024-09-19  0:33       ` Po Lu
  2024-09-19  4:29       ` Gerd Möllmann
@ 2024-09-19  4:58       ` Eli Zaretskii
  2024-09-19  8:10         ` martin rudalics
  2 siblings, 1 reply; 35+ messages in thread
From: Eli Zaretskii @ 2024-09-19  4:58 UTC (permalink / raw)
  To: martin rudalics; +Cc: gerd.moellmann, emacs-devel

> Date: Wed, 18 Sep 2024 20:52:00 +0200
> Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org
> From: martin rudalics <rudalics@gmx.at>
> 
>  > What you describe makes sens for GUI frames, but seems to make little
>  > sense for TTY frames, because frame visibility situation there is much
>  > simpler.
> 
> You mean because only one normal frame can be visible at any time.
> However, child frames complicate the situation considerably because
> Emacs itself has to take care of their visibility instead of the WM.
> 
> For example, I can type into a GUI window text beneath a (small) child
> frame as long as that child frame doesn't have focus.  Emulating such
> behavior with text emanating at the right of the child frame on a TTY
> seems tricky at least.

I'm saying that this scenario which you described:

> Reparenting is useful because you can set up one child frame for some
> special purpose, make it invisible when you don't need it, and move it
> to another frame and make it visible there whenever you want to.  On
> GUIs, this approach has the advantage that you can avoid the (at least
> here) costly process of setting up frame faces every time anew.  Emacs
> tooltips do that by default and I recall that showing a tooltip every
> time incurred two entire GC cycles here.

sounds not very useful to me on a TTY, because switching frames on a
TTY will make the child frame invisible anyway.  And why would I want
to see a child of frame F1 when I display only frame F2?

So reparenting seems almost pointless on a TTY.

Of course, I'm not objected to allowing such reparenting on TTY
displays, but given that Gerd says it's not trivial, I think we will
be fine without that feature on TTY displays.



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

* Re: Question about üarent-frame changes
  2024-09-18 18:51     ` martin rudalics
@ 2024-09-19  5:01       ` Eli Zaretskii
  2024-09-19  8:10         ` martin rudalics
  0 siblings, 1 reply; 35+ messages in thread
From: Eli Zaretskii @ 2024-09-19  5:01 UTC (permalink / raw)
  To: martin rudalics; +Cc: shipmints, gerd.moellmann, emacs-devel

> Date: Wed, 18 Sep 2024 20:51:21 +0200
> Cc: Gerd Möllmann <gerd.moellmann@gmail.com>,
>  Emacs Devel <emacs-devel@gnu.org>
> From: martin rudalics <rudalics@gmx.at>
> 
> Still it's good to know that people do use multiple frames on TTYs.

Of course they do; I do.  We even have commands specifically for that
use case: select-frame-by-name.  That command only makes sense if you
have more than 2 frames on a TTY display.



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

* Re: Question about üarent-frame changes
  2024-09-19  0:33       ` Po Lu
@ 2024-09-19  8:08         ` martin rudalics
  0 siblings, 0 replies; 35+ messages in thread
From: martin rudalics @ 2024-09-19  8:08 UTC (permalink / raw)
  To: Po Lu; +Cc: Eli Zaretskii, gerd.moellmann, emacs-devel

Are there any?> Most of the extant popup packages that exercise child frames also retain
 > and reparent them across different parents,

What do the less extant packages do instead?  Do they exist at all?

 > and as such, Gerd will need
 > to implement reparenting.

Or emulate it in some way.

martin



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

* Re: Question about üarent-frame changes
  2024-09-19  4:29       ` Gerd Möllmann
@ 2024-09-19  8:09         ` martin rudalics
  2024-09-19  9:15           ` Gerd Möllmann
  0 siblings, 1 reply; 35+ messages in thread
From: martin rudalics @ 2024-09-19  8:09 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: Eli Zaretskii, emacs-devel

 > The biggest problem for me in this area today is that "visibility" on
 > GUIs and ttys apparently is not the same thing. For example,
 > make-frame-visible seems to do nothing for tty frames. So I guess all
 > tty frames are always visible in the sense that frame::visible is
 > non-zero.

You mean because 'suspend-tty' acts on top-level frames only?

Another issue we would have to resolve in some way is whether a child
frame should (or could) be given input focus on TTYs: That is, whether a
user may type "into" a child frame, for example, when an application
issues a 'yes-or-no-p' question within a child frame equipped with a
minibuffer window.

 > But that would be too easy of course, which is why frame::visible has 2
 > bits, and if the second bit is set the frame is "obscured" (happens with
 > C-x 5 2), which I'd call sort of invisible because it can't be seen but
 > that's of course naive.

Wasn't that second bit used exclusively for redisplay purposes and as
such not available to Lisp code?

martin



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

* Re: Question about üarent-frame changes
  2024-09-19  4:58       ` Eli Zaretskii
@ 2024-09-19  8:10         ` martin rudalics
  2024-09-19  8:20           ` Eli Zaretskii
  2024-09-19  9:26           ` Gerd Möllmann
  0 siblings, 2 replies; 35+ messages in thread
From: martin rudalics @ 2024-09-19  8:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gerd.moellmann, emacs-devel

 > I'm saying that this scenario which you described:
 >
 >> Reparenting is useful because you can set up one child frame for some
 >> special purpose, make it invisible when you don't need it, and move it
 >> to another frame and make it visible there whenever you want to.  On
 >> GUIs, this approach has the advantage that you can avoid the (at least
 >> here) costly process of setting up frame faces every time anew.  Emacs
 >> tooltips do that by default and I recall that showing a tooltip every
 >> time incurred two entire GC cycles here.
 >
 > sounds not very useful to me on a TTY, because switching frames on a
 > TTY will make the child frame invisible anyway.  And why would I want
 > to see a child of frame F1 when I display only frame F2?

Because the calling code may reparent the child frame from F1 to F2
whenever the user switches from frame F1 to frame F2.  At least Po Lu
said that applications do such reparenting.

 > So reparenting seems almost pointless on a TTY.

If the application asks for it, we'd have to decide what to do.  Clone
the child frame in some way, for example, so that while there are two
physical child frames - one for F1 and one for F2 - the application sees
only one.

martin



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

* Re: Question about üarent-frame changes
  2024-09-19  5:01       ` Eli Zaretskii
@ 2024-09-19  8:10         ` martin rudalics
  0 siblings, 0 replies; 35+ messages in thread
From: martin rudalics @ 2024-09-19  8:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: shipmints, gerd.moellmann, emacs-devel

 >> Still it's good to know that people do use multiple frames on TTYs.
 >
 > Of course they do; I do.  We even have commands specifically for that
 > use case: select-frame-by-name .  That command only makes sense if you
 > have more than 2 frames on a TTY display.

I never noticed that.

Thanks for the explanation, martin



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

* Re: Question about üarent-frame changes
  2024-09-19  8:10         ` martin rudalics
@ 2024-09-19  8:20           ` Eli Zaretskii
  2024-09-19  8:41             ` Po Lu
  2024-09-19  9:26           ` Gerd Möllmann
  1 sibling, 1 reply; 35+ messages in thread
From: Eli Zaretskii @ 2024-09-19  8:20 UTC (permalink / raw)
  To: martin rudalics; +Cc: gerd.moellmann, emacs-devel

> Date: Thu, 19 Sep 2024 10:10:11 +0200
> Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org
> From: martin rudalics <rudalics@gmx.at>
> 
>  > sounds not very useful to me on a TTY, because switching frames on a
>  > TTY will make the child frame invisible anyway.  And why would I want
>  > to see a child of frame F1 when I display only frame F2?
> 
> Because the calling code may reparent the child frame from F1 to F2
> whenever the user switches from frame F1 to frame F2.  At least Po Lu
> said that applications do such reparenting.

Isn't that the same as simply showing the child frame even though its
parent frame is obscured?

And I'd need to hear more details about what the application wants to
achieve by such reparenting, to understand the issue.

>  > So reparenting seems almost pointless on a TTY.
> 
> If the application asks for it, we'd have to decide what to do.  Clone
> the child frame in some way, for example, so that while there are two
> physical child frames - one for F1 and one for F2 - the application sees
> only one.

What do those applications do now on TTY displays, when child frames
are not available at all?  We should keep the current situation in
mind when assessing the potential damage of not supporting
reparenting.  Assessing that from the POV of what is available on GUI
displays skews the perspective.

And once again: if implementing reparenting is not hard, I'm not
objected to having it.  All I'm saying is that it sounds like not
having that on TTYs will not be a huge loss, and the feature will be
useful enough even without that -- if implementing that is hard.



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

* Re: Question about üarent-frame changes
  2024-09-19  8:20           ` Eli Zaretskii
@ 2024-09-19  8:41             ` Po Lu
  2024-09-19 10:30               ` Eli Zaretskii
  0 siblings, 1 reply; 35+ messages in thread
From: Po Lu @ 2024-09-19  8:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: martin rudalics, gerd.moellmann, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Thu, 19 Sep 2024 10:10:11 +0200
>> Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org
>> From: martin rudalics <rudalics@gmx.at>
>> 
>>  > sounds not very useful to me on a TTY, because switching frames on a
>>  > TTY will make the child frame invisible anyway.  And why would I want
>>  > to see a child of frame F1 when I display only frame F2?
>> 
>> Because the calling code may reparent the child frame from F1 to F2
>> whenever the user switches from frame F1 to frame F2.  At least Po Lu
>> said that applications do such reparenting.
>
> Isn't that the same as simply showing the child frame even though its
> parent frame is obscured?
>
> And I'd need to hear more details about what the application wants to
> achieve by such reparenting, to understand the issue.

They simply wish to retain created child frames for as long a period as
possible, because frame creation is expensive, and configuring a child
frame to behave as intended is hard work.  See posframe.el (on ELPA) for
a typical instance, where three years ago I encountered the same dilemma
with the Haiku port.



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

* Re: Question about üarent-frame changes
  2024-09-19  8:09         ` martin rudalics
@ 2024-09-19  9:15           ` Gerd Möllmann
  2024-09-19  9:40             ` martin rudalics
  0 siblings, 1 reply; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-19  9:15 UTC (permalink / raw)
  To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1812 bytes --]

martin rudalics <rudalics@gmx.at> writes:

>> The biggest problem for me in this area today is that "visibility" on
>> GUIs and ttys apparently is not the same thing. For example,
>> make-frame-visible seems to do nothing for tty frames. So I guess all
>> tty frames are always visible in the sense that frame::visible is
>> non-zero.
>
> You mean because 'suspend-tty' acts on top-level frames only?

Haven't looked at suspend-tty yet. The list grows and grows :-).

No, the problem is that the whole hide/show frames is not implemented on
ttys presently. But I think I need that to work as it does on GUIs to be
compatible with existing packages like Corfu, which uses that.

Which means I have to implement hide/show on ttys like it is on GUIS,
amd handle the "obscured" case differently. Not sure sure if it needs a
bit in the frame at all, FWIW, since we know the topmost frame root
frame on a tty anyway, which is the only one that is visible. Anyway.
Doesn't look like a lot of fun :-).

> Another issue we would have to resolve in some way is whether a child
> frame should (or could) be given input focus on TTYs: That is, whether a
> user may type "into" a child frame, for example, when an application
> issues a 'yes-or-no-p' question within a child frame equipped with a
> minibuffer window.

My aim is to let tty child frames act like their GUI counterpart as far
as possible, which seems to mean that child frames act like any other
frame for the most part.

And that's the case currently with what I have so far. Opening a child
frame is like C-x 5 2, only that the child is displayed on top of its
parent and so on. The child can have a minibuffer and everything else.
(Except for the menu bar thing we talked about, I deliberately turned
that off).

In the y-or-n-p case, this looks like this


[-- Attachment #2: Screenshot 2024-09-19 at 11.05.56.png --]
[-- Type: image/png, Size: 445852 bytes --]

[-- Attachment #3: Type: text/plain, Size: 887 bytes --]


That is with

(defun emacs-user:my-make-child ()
  (interactive)
  (make-frame `((parent-frame . ,(selected-frame))
		(background-color . "gray10")
		(foreground-color . "white")
		(top . 15)
		(left . 40)
		(width . 80)
		(height . 25))))

So it's a "normal" frame. Haven't gotten to minibuffer-only frames and
what else is possible. (TIL there is also a delete-after or so frame
parameter). There is probably something lurking there as well.

>> But that would be too easy of course, which is why frame::visible has 2
>> bits, and if the second bit is set the frame is "obscured" (happens with
>> C-x 5 2), which I'd call sort of invisible because it can't be seen but
>> that's of course naive.
>
> Wasn't that second bit used exclusively for redisplay purposes and as
> such not available to Lisp code?

That's true, but the whole rest of hiding/showing frames isn't there on
ttys.

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

* Re: Question about üarent-frame changes
  2024-09-19  8:10         ` martin rudalics
  2024-09-19  8:20           ` Eli Zaretskii
@ 2024-09-19  9:26           ` Gerd Möllmann
  2024-09-19 13:46             ` Po Lu
  1 sibling, 1 reply; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-19  9:26 UTC (permalink / raw)
  To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel

martin rudalics <rudalics@gmx.at> writes:

> If the application asks for it, we'd have to decide what to do.  Clone
> the child frame in some way, for example, so that while there are two
> physical child frames - one for F1 and one for F2 - the application sees
> only one.

Cloning won't be necessary, that's a thing I can say with certainty.
With what I have done today, reparenting a child will be allowed, but
not making a child a root or the other way 'round, for reasons of
laziness if you will.

And I got a redisplay problem when popping up a backtrace buffer on a
child frame for some reason. Hm, new list entry.



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

* Re: Question about üarent-frame changes
  2024-09-19  9:15           ` Gerd Möllmann
@ 2024-09-19  9:40             ` martin rudalics
  2024-09-19 10:10               ` Gerd Möllmann
  0 siblings, 1 reply; 35+ messages in thread
From: martin rudalics @ 2024-09-19  9:40 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: Eli Zaretskii, emacs-devel

 > In the y-or-n-p case, this looks like this

Looks good.  But where does the user's answer appear?  In the
child-frame's minibuffer window?

martin



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

* Re: Question about üarent-frame changes
  2024-09-19  9:40             ` martin rudalics
@ 2024-09-19 10:10               ` Gerd Möllmann
  2024-09-19 11:13                 ` martin rudalics
  0 siblings, 1 reply; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-19 10:10 UTC (permalink / raw)
  To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel

martin rudalics <rudalics@gmx.at> writes:

>> In the y-or-n-p case, this looks like this
>
> Looks good.  But where does the user's answer appear?  In the
> child-frame's minibuffer window?

If you mean the 'y' when I type y at the prompt, that appears just after
the prompt, that should be the echo area I think.

(Sorry couldn't make a screen capture of that because I either can't type
anything into Emacs when Screen Capture runs, or the echo area is
cleared when I start Screen Capture.)



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

* Re: Question about üarent-frame changes
  2024-09-19  8:41             ` Po Lu
@ 2024-09-19 10:30               ` Eli Zaretskii
  2024-09-19 11:13                 ` martin rudalics
  0 siblings, 1 reply; 35+ messages in thread
From: Eli Zaretskii @ 2024-09-19 10:30 UTC (permalink / raw)
  To: Po Lu; +Cc: rudalics, gerd.moellmann, emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: martin rudalics <rudalics@gmx.at>,  gerd.moellmann@gmail.com,
>   emacs-devel@gnu.org
> Date: Thu, 19 Sep 2024 16:41:24 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Date: Thu, 19 Sep 2024 10:10:11 +0200
> >> Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org
> >> From: martin rudalics <rudalics@gmx.at>
> >> 
> >>  > sounds not very useful to me on a TTY, because switching frames on a
> >>  > TTY will make the child frame invisible anyway.  And why would I want
> >>  > to see a child of frame F1 when I display only frame F2?
> >> 
> >> Because the calling code may reparent the child frame from F1 to F2
> >> whenever the user switches from frame F1 to frame F2.  At least Po Lu
> >> said that applications do such reparenting.
> >
> > Isn't that the same as simply showing the child frame even though its
> > parent frame is obscured?
> >
> > And I'd need to hear more details about what the application wants to
> > achieve by such reparenting, to understand the issue.
> 
> They simply wish to retain created child frames for as long a period as
> possible, because frame creation is expensive, and configuring a child
> frame to behave as intended is hard work.  See posframe.el (on ELPA) for
> a typical instance, where three years ago I encountered the same dilemma
> with the Haiku port.

In what sense is creating and configuring a frame "expensive" and
"hard"?  Given that we have current-window-configuration and
set-window-configuration, I wouldn't expect it to be hard.



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

* Re: Question about üarent-frame changes
  2024-09-19 10:10               ` Gerd Möllmann
@ 2024-09-19 11:13                 ` martin rudalics
  2024-09-19 12:49                   ` Gerd Möllmann
  0 siblings, 1 reply; 35+ messages in thread
From: martin rudalics @ 2024-09-19 11:13 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: Eli Zaretskii, emacs-devel

 >> Looks good.  But where does the user's answer appear?  In the
 >> child-frame's minibuffer window?
 >
 > If you mean the 'y' when I type y at the prompt, that appears just after
 > the prompt, that should be the echo area I think.

Good.  I asked because I didn't see the cursor in the minibuffer window.
But screenshots often don't capture cursors.

martin



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

* Re: Question about üarent-frame changes
  2024-09-19 10:30               ` Eli Zaretskii
@ 2024-09-19 11:13                 ` martin rudalics
  2024-09-19 11:33                   ` Eli Zaretskii
  0 siblings, 1 reply; 35+ messages in thread
From: martin rudalics @ 2024-09-19 11:13 UTC (permalink / raw)
  To: Eli Zaretskii, Po Lu; +Cc: gerd.moellmann, emacs-devel

 > In what sense is creating and configuring a frame "expensive" and
 > "hard"?  Given that we have current-window-configuration and
 > set-window-configuration, I wouldn't expect it to be hard.

Neither of these are of any use for new frames.

martin



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

* Re: Question about üarent-frame changes
  2024-09-19 11:13                 ` martin rudalics
@ 2024-09-19 11:33                   ` Eli Zaretskii
  0 siblings, 0 replies; 35+ messages in thread
From: Eli Zaretskii @ 2024-09-19 11:33 UTC (permalink / raw)
  To: martin rudalics; +Cc: luangruo, gerd.moellmann, emacs-devel

> Date: Thu, 19 Sep 2024 13:13:21 +0200
> Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org
> From: martin rudalics <rudalics@gmx.at>
> 
>  > In what sense is creating and configuring a frame "expensive" and
>  > "hard"?  Given that we have current-window-configuration and
>  > set-window-configuration, I wouldn't expect it to be hard.
> 
> Neither of these are of any use for new frames.

Too bad.  But we still have frameset.el.



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

* Re: Question about üarent-frame changes
  2024-09-19 11:13                 ` martin rudalics
@ 2024-09-19 12:49                   ` Gerd Möllmann
  0 siblings, 0 replies; 35+ messages in thread
From: Gerd Möllmann @ 2024-09-19 12:49 UTC (permalink / raw)
  To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

martin rudalics <rudalics@gmx.at> writes:

>>> Looks good.  But where does the user's answer appear?  In the
>>> child-frame's minibuffer window?
>>
>> If you mean the 'y' when I type y at the prompt, that appears just after
>> the prompt, that should be the echo area I think.
>
> Good.  I asked because I didn't see the cursor in the minibuffer window.
> But screenshots often don't capture cursors.

Ah, okay, that's something special with y-or-n-p. Here's something from
M-x where one can see the use of the minibuffer of the child frame:


[-- Attachment #2: Screenshot 2024-09-19 at 14.45.08.png --]
[-- Type: image/png, Size: 257075 bytes --]

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

* Re: Question about üarent-frame changes
  2024-09-19  9:26           ` Gerd Möllmann
@ 2024-09-19 13:46             ` Po Lu
  0 siblings, 0 replies; 35+ messages in thread
From: Po Lu @ 2024-09-19 13:46 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: martin rudalics, Eli Zaretskii, emacs-devel

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> Cloning won't be necessary, that's a thing I can say with certainty.
> With what I have done today, reparenting a child will be allowed, but
> not making a child a root or the other way 'round, for reasons of
> laziness if you will.

This is alright, for it is already more or less true of the popular GUI
builds, and for reasons beyond our control.



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

end of thread, other threads:[~2024-09-19 13:46 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-18 10:58 Question about üarent-frame changes Gerd Möllmann
2024-09-18 14:15 ` martin rudalics
2024-09-18 14:24   ` Ship Mints
2024-09-18 18:51     ` martin rudalics
2024-09-19  5:01       ` Eli Zaretskii
2024-09-19  8:10         ` martin rudalics
2024-09-18 14:26   ` Robert Pluim
2024-09-18 14:30     ` Ship Mints
2024-09-18 15:26       ` Gerd Möllmann
2024-09-18 15:32         ` Ship Mints
2024-09-18 15:22     ` Gerd Möllmann
2024-09-18 18:51     ` martin rudalics
2024-09-18 15:03   ` Gerd Möllmann
2024-09-18 16:14     ` Eli Zaretskii
2024-09-18 16:42       ` Gerd Möllmann
2024-09-18 16:15   ` Eli Zaretskii
2024-09-18 18:52     ` martin rudalics
2024-09-19  0:33       ` Po Lu
2024-09-19  8:08         ` martin rudalics
2024-09-19  4:29       ` Gerd Möllmann
2024-09-19  8:09         ` martin rudalics
2024-09-19  9:15           ` Gerd Möllmann
2024-09-19  9:40             ` martin rudalics
2024-09-19 10:10               ` Gerd Möllmann
2024-09-19 11:13                 ` martin rudalics
2024-09-19 12:49                   ` Gerd Möllmann
2024-09-19  4:58       ` Eli Zaretskii
2024-09-19  8:10         ` martin rudalics
2024-09-19  8:20           ` Eli Zaretskii
2024-09-19  8:41             ` Po Lu
2024-09-19 10:30               ` Eli Zaretskii
2024-09-19 11:13                 ` martin rudalics
2024-09-19 11:33                   ` Eli Zaretskii
2024-09-19  9:26           ` Gerd Möllmann
2024-09-19 13:46             ` Po Lu

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.