Subject: Re: bug#27901: 25.1; x-win-suspend-error: Cannot suspend Emacs while running under X

From: Francesco Potortì <[email-masked]>
Date: Sat, 05 Aug 2017 21:03:36 +0200

>> Date: Sat, 05 Aug 2017 20:27:00 +0200
>> From: Francesco Potortì <[email-masked]>
>> Cc: [email-masked]
>> 
>> >> The terminal frame is running inside a terminal under Screen.  When I
>> >> access it remotely, I have no access to the GUI.  I cannot suspend Emacs
>> >> because there is a graphical frame alive, and I cannot close it because
>> >> I do not know how, and the only way I can think of makes the terminal
>> >> frame unusable (which I suspect is a bug).
>> >
>> >What does frame-list return?
>> 
>> (frame-list)
>> (#<frame [email-masked] 0x116995f8> #<frame F1 0xc41680>)
>> 
>> (next-frame)
>> #<frame F1 0xc41680>
>> 
>> (delete-frame (next-frame))
>> ^^
>> shows the bug (I won't do it now because I am working remotely)
>
>The F1 frame is a TTY frame, so it sounds like you are trying to
>delete the frame through which you are communicating with Emacs?

Wow, that's it, thanks!  I had not realised that (next-frame) is the
wrong way to choose a frame, because it looks for frames in the same
terminal!

I was looking for a function that gives me the same frame that C-x 5 o
switches to.

>And do you see the same problem when both frames are on the same
>machine?

Yes, I only tried those things when on the same machine, but now the
reason looks obvious to me: I was just deleting the frame I was using,
because (next-frame) returns that, so there is no bug here.

>> A shell inside Emacs does not have the environment I am looking for
>
>Why not?

Because I want a real terminal, not a shell buffer, and I do not want to
use a terminal emulator inside Emacs.  But this is out of scope.

Ok, so now the problem reduces to:
- find a simple recipe for deleting all GUI frames from a terminal frame
- add this recipe to the error message mentioned at the start of this
  bug report

Thanks so far