0

I was thinking about how I work normally on services. Where I might write code in an editor via Emacs in a terminal view, and in another terminal run the code, and yet still in another view tail the log.

I'd like to do something similar but with Emacs. For instance, write some code in elisp which updates a buffer that's something like a log, but I'd like to put that log/view on another window in another terminal altogether, but controlled from one Emacs. Is this possible? If so how?

1 Answer 1

2

It sounds like this would be addressed by running Emacs in daemon mode. For instance, when I start up I run:

emacs --daemon

Then I can start a new client with

emacsclient -nw my/file

And in another terminal open a client with no file with

emacsclient -nw

(-nw = use console rather than opening a GUI window, but also avoids needing to provide a file.)

Both clients share the same set of buffers; it's like opening a new frame in a GUI version of Emacs.

I have an idiosyncratic config for server mode, but I believe this will work as described out of the box, as it were. You can read in more detail at https://www.emacswiki.org/emacs/EmacsAsDaemon

2
  • I think this might work. Do you know if other-window command takes into account windows in another terminal? Or if there is an alternative command that does so?
    – lucidquiet
    Aug 13, 2020 at 20:19
  • I'm 99% sure you need your window manager to switch between separate terminal windows. When Emacs is running in a terminal, I don't imagine it has any control over the GUI environment outside of that terminal. (You might be able to teach Emacs to talk to your window manager in order to invoke a "switch to another terminal" command, but that would depend on whether your WM provided such a command in the first place.)
    – phils
    Aug 13, 2020 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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