2

I'm using emacs in daemon mode on a server and connecting over ssh in a terminal console (tty) window (i.e. no GUI support).

I'm invoking emacsclient using in the tty window (window here refers to OS application window, not emacs window) using: emacsclient -nw

Everything so far works as expected.

I can spawn a second tty window and run a second emacsclient -nw on the same server and it will operate like a second frame which is useful if you have a multi-monitor setup.

However I can't get the the following to work:

  1. I have focus on one terminal window and call, for example, C-x 5 d.
  2. What happens is I get a new dired buffer in the same tty window as I entered the command.
  3. I was hoping that the C-x 5 would mean that dired was opened in the other frame, i.e. the other tty window.

My question is how can I harness the C-x 5 commands when using two different tty windows containing two different emacsclient instances on the same server?

$ emacs --version
GNU Emacs 26.3

Terminal emulator = wsltty

0

1 Answer 1

1

Are you sure that you don't have multiple frames in the same "tty window"? Does this doc help explain how to move among multiple frames when Emacs is in a text terminal?

On a text terminal, Emacs can display only one Emacs frame at a time. However, you can still create multiple Emacs frames, and switch between them. Switching frames on these terminals is much like switching between different window configurations.

I don't think there is a way to have C-x 5 <whatever> use a completely different emacsclient session.

4
  • Yes - this is what I believe is happening - a new frame is created inside the same emacsclient, but it would seem at least technically possible to throw this to the other emacsclient session given they are both clients of the same daemon? What I was hoping would happen is if I have a single frame in the first emacsclient and I create a new emacsclient (with a single new frame), that any prefix sending a buffer to the "other" frame would pick the frame in the other emacsclient session. However this doesn't seem to happen - instead a new frame is created on the first client.
    – Phil
    Mar 9, 2020 at 16:45
  • 2
    If you know which tty the other emacsclient session is using, you can pass that to make-terminal-frame. See the help for make-terminal-frame.
    – rpluim
    Mar 9, 2020 at 17:01
  • I see, thanks. I can see list of frames using (frame-list) and I can see which tty a given emacsclient terminal is on using (frame-terminal). I guess what I need now is a way of sending a particular emacs buffer to a particular frame. I'm not sure there's a straightforward way to do that?
    – Phil
    Mar 9, 2020 at 18:12
  • Not really. You'd have to write your own function using frame-list, terminal-list and terminal-name.
    – rpluim
    Mar 10, 2020 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.