Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bang completion kills zsh in emacs process buffer



"Dwight Shih" wrote:
>  To reproduce:
>   start emacs
>   M-x shell
>  $ pwd
>  $ echo !$      #zsh will now die
>
>  In the debugger, zsh dies at hist.c:1092 trying to do a zputs(prt,shout)
>  because the file pointer shout is null.

The confusion comes because somehow zsh thinks it's non-interactive but
is still using history --- which is basically what you said.

It surprises me a bit that it's trying to use bang-history at all in this
case.  It's usually turned off non-interactively.  Ideally we need to
track down why it's doing that.  I can't seem to reproduce it --- partly
because shell mode is stealing my !'s for some purpose of its own I can
only guess at, which indicates some of the reasons I never use Emacs
shell mode.

It might help to see the options it has set; the options related to
interactive or non-interactive operations are interactive, shinstdin and
monitor.  This is the code in hbegin which I think should be stopping it
using history for non-interactive shells:

    else if (dohist != 2)
	stophist = (!interact || unset(SHINSTDIN)) ? 2 : 0;

(interact is a definition for isset(INTERACTIVE); it would be much
clearer and hardly longers to use the latter throughout.  Possibly it
used to mean something else.)

So stophist should be 2 in this case (we should use enums for this sort
of flag but this code goes back to the dawn of time).  If you feel
inclined to track this down (which would be much appreciated), finding
out if stophist is getting set to 2, and if it is why we are doing
bang-history anyway, would be a good path to take.

Testing for shout != NULL in hist.c is an entirely benign workaround if
no-one is able to find out why it's using history at all, but I don't
think it's the root of the problem.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author