[gnu.emacs] sending regions to child processes

windley@cheetah.ucdavis.edu (Phil Windley/20000000) (01/16/90)

Scenario:  

  1.) GNU Emacs running standard shell mode (using pty's)
  2.) Start up large interpreter under shell
  3.) Cut a large region from another window and paste it in shell window
  4.) Only first X (I don't know exactly how many) characters are sent and
      the rest are ignored.

Has anyone seen this before?  I'm fairly certain that its not the
interpreter, but I'm not sure.  I'm not sure even how to debug this one.

--phil--
--
Phil Windley                          |  windley@cheetah.ucdavis.edu
Division of Computer Science          |  ucbvax!ucdavis!cheetah!windley
University of California, Davis       |
Davis, CA 95616                       |  (916) 752-6452 (or 3168)

lbn@iesd.auc.dk (Lars Bo Nielsen) (01/16/90)

In article <WINDLEY.90Jan15205601@cheetah.cheetah.ucdavis.edu> windley@cheetah.ucdavis.edu (Phil Windley/20000000) writes:
>
>Scenario:  
>
> 1.) GNU Emacs running standard shell mode (using pty's)
> 2.) Start up large interpreter under shell
> 3.) Cut a large region from another window and paste it in shell window
> 4.) Only first X (I don't know exactly how many) characters are sent and
>     the rest are ignored.

>Has anyone seen this before?  I'm fairly certain that its not the
>interpreter, but I'm not sure.  I'm not sure even how to debug this one.

There is is bug/restriction in the un*x operative system. I
"discovered" it when I was writing sml-mode.

When you "paste" your region into the shell-window, it is handled by
the emacs function:

	process-send-region:
	Send current contents of region as input to PROCESS.
	PROCESS may be a process name.
	Called from program, takes three arguments, PROCESS, START and END.

Now the problem is that emacs talks to the shell (or the program
running under the shell) through a pipe. Depending on which version of
un*x you are running, there is a certain limit of the buffer that is
allocated for the pipe. If, say, this limit is 4K and you "paste" >4K
into the shell-window, this will block the pipe, and you may even run into
some strange error-messages.

I got around this problem, by writing a emacs-function that writes the
region to a temporary file, and then sends a "use" to the interpreter
(in this case sml).

Hope this helps.

---
 Lars Bo Nielsen @ Aalborg University - Denmark     lbn@iesd.auc.dk
 Wise words: Vir prudens non contra ventum mingit.  {...}!mcvax!diku!iesd!lbn
---