2

I would like to write an Emacs front-end to a server which supports Telnet connections, and I was wondering if there is an idiomatic way of doing this. Specifically, the program will work like this:

  • Use the telnet function to connect to the server.
  • Read the output of the telnet command so far, and transform it, and insert it into a buffer. This buffer will be different than the telnet buffer.
  • Send commands to the telnet server as the user interactively executes functions

What I don't understand is the following:

  • How can I programmatically read what the server is sending in the telnet process? Right now when I use the telnet function it creates a new buffer and switches to it, which is great for interactive use, but not for programmatic reading of output.
  • The same for inputting something to the telnet process: how can I send text to it?

I know that a lot of Emacs packages use the command line to do things, but those commands are, as far as I know, pretty straightforward: you run the command, it gives you some output, and then quits. However, in this case the command keeps working in the background, and I need to read its output and send it input.

Thanks!

1

If the user doesn't interact directly with the process, then you're looking for start-(file-)process or make-process. Othrwise you might like to look at comint-exec.

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.