3

I would like to have a text buffer for writing to a file on the left side and a shell (zsh) on the right side for interacting with a REPL. Is that possible?

At the moment I realize that with tmux showing emacs in the left pane. But I wonder how this can also be done within emacs.

Raffael
  • 215
  • 2
  • 6

2 Answers2

4

Is it correct to assume that you're new to Emacs? If yes, are you aware of how Emacs manages windows and that the term 'window' does not refer to what you think it does? The concepts 'windows' and 'frames' are described on https://www.gnu.org/software/emacs/manual/html_node/elisp/Windows-and-Frames.html and (more from the user's perspective) on https://www.gnu.org/software/emacs/manual/html_node/emacs/Screen.html#Screen and the nodes linked from there.

Once you understand that, you'll find it easy to create and navigate windows using the commands you can find on https://www.gnu.org/software/emacs/manual/html_node/emacs/Windows.html#Windows and its child nodes.

You can invoke a shell using M-x shell or M-x term, but you probably know that already.

With those basics out of the way, maybe you could explain which kind of REPL you want to interact with. For example for Clojure and Common Lisp there are dedicated projects which help you creating and interacting with the appropriate REPLs, namely Cider and SLIME.

Hope that makes sense.

  • well - I din't even use the term "window". I referred to buffers. anyway - your answer contained valuable information despite being a bit condescending. – Raffael Jul 20 '18 at 12:34
  • 1
    Dear @Raffael, sorry if I came across condescending. It was certainly not intended that way. Hopefully you can attribute that to me being a non-native speaker who even had to look up "condescending". Should you ever be in Berlin, drop a note. First drink is on me. :-) – Stefan Kamphausen Jul 20 '18 at 17:22
  • never mind. thanks for the answer ;) – Raffael Jul 20 '18 at 22:32
1

Absolutely. Turn on shell-script-mode/sh-mode in the scriptfile buffer, perhaps switch to zsh with C-c : for sh-set-shell (could change the first line of your script), and maybe mark some lines and press C-c C-n for sh-send-line-or-region-and-step - this did not switch to a re-used shell-buffer in the other window in my experiments. I can't figure out how to associate a certain shell buffer for a script buffer.

You can execute the complete script with C-c C-x for executable-interpret, but I can't quite tell how that might interact with interactive scripts.

p_wiersig
  • 1,051
  • 9
  • 15