[comp.emacs] MicroEMACS 3.9e patch for bug in pipe-command ^X-@, others

karl@sugar.UUCP (Karl Lehenbauer) (11/28/87)

Here are some context diffs for MicroEMACS 3.9e.  The most important one is
a fix for a bug in pipe-command (^X-@) that caused it to not work a lot
(all versions).   There are a couple of trivial error message changes
that one may or may not think are useful.  Finally, there is a hack
for Unix for pipe-command to write stderr output to the command buffer
as well as standard output.

This is a trivial change to make the message "Can not delete this window"
tell you why, too, as in "Can not delete the only window":

*** window.orig	Fri Nov 27 02:25:46 1987
--- window.c	Fri Nov 27 02:26:11 1987
***************
*** 252,254
  	if (wheadp->w_wndp == NULL) {
! 		mlwrite("Can not delete this window");
  		return(FALSE);

--- 252,254 -----
  	if (wheadp->w_wndp == NULL) {
! 		mlwrite("Can not delete the only window");
  		return(FALSE);

This is also a trivial change to make the "Buffer is being displayed"
error message explain what EMACS was trying to do, as in "Can't delete 
buffer - it is being displayed":

*** buffer.orig	Fri Nov 27 16:02:28 1987
--- buffer.c	Fri Nov 27 16:03:00 1987
***************
*** 146,148
          if (bp->b_nwnd != 0) {                  /* Error if on screen.  */
!                 mlwrite("Buffer is being displayed");
                  return (FALSE);

--- 146,148 -----
          if (bp->b_nwnd != 0) {                  /* Error if on screen.  */
!                 mlwrite("Can't delete buffer - it is being displayed");
                  return (FALSE);

This is a tricky one.  When doing pipe-command, ^X-@, the code is supposed
to delete the buffer "command" prior to starting the subshell.  To do this,
it first has to remove the window from the screen.  Unfortunately, the 
existing version removes the current window rather than command window.  This 
patch fixes it in a not-certain-to-be-perfect-way.  Specifically, ^X-@ still 
won't work if command is the only window.  Also, I don't know if the
"curbp = wp->w_bufp" is necessary or not.

The second little hack causes stderr output in commands executed by pipe-command
(^X-@) to go into the output buffer, too.  This way, one can write
uEMACS macros to crack error messages from the C compiler and such, just like
the big boys :-)  Ultimately I think it should direct error output into
a different buffer (named stderr perhaps?)  Then, the cool one-key "make"
macro could look at the exit status and see if the stderr window was needed,
etc. etc. etc.

*** spawn.orig	Fri Nov 27 02:07:41 1987
--- spawn.c	Fri Nov 27 15:57:03 1987
***************
*** 382,384
  			if (wp->w_bufp == bp) {
! 				onlywind(FALSE, 1);
  				break;

--- 382,387 -----
  			if (wp->w_bufp == bp) {
! 				/* still fails if command is only window on screen */
! 				curwp = wp;
! 				curbp = wp->w_bufp;
! 				delwind(FALSE, 1);
  				break;
***************
*** 426,427
  	strcat(line,filnam);
          system(line);

--- 429,431 -----
  	strcat(line,filnam);
+ 	strcat(line," 2>&1");		/* get stderr, too */
          system(line);


--