From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28791 invoked from network); 19 Sep 2003 17:19:18 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Sep 2003 17:19:18 -0000 Received: (qmail 4312 invoked by alias); 19 Sep 2003 17:19:10 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19104 Received: (qmail 4297 invoked from network); 19 Sep 2003 17:19:10 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 19 Sep 2003 17:19:10 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 19 Sep 2003 17:19:8 -0000 Received: from EXCHANGE02.csr.com (unverified) by MAILSWEEPER01.cambridgesiliconradio.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Fri, 19 Sep 2003 18:17:52 +0100 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.5329); Fri, 19 Sep 2003 18:21:18 +0100 To: zsh-workers@sunsite.dk Subject: Re: Bang completion kills zsh in emacs process buffer In-reply-to: ""Dwight Shih""'s message of "Fri, 19 Sep 2003 12:02:25 CDT." <20030919170225.145F5757CF@smtp.us2.messagingengine.com> Date: Fri, 19 Sep 2003 18:19:01 +0100 Message-ID: <13065.1063991941@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 19 Sep 2003 17:21:18.0371 (UTC) FILETIME=[6FFED730:01C37ED2] "Dwight Shih" wrote: > Peter, > > zsh thinks that it's an interactive shell because emacs invokes it with > the -i option. OK, I think I see what's going on now. !-history is in use because: - the shell is interactive, and - shell input is standard input shout gets set if: - the shell is interactive, and - SHTTY is set SHTTY is set if and only we are talking to a tty on fd 0, and we aren't. We can't very well set it or shout in that case. (We could in principle look harder for a tty, but that's not the issue here --- there just isn't one.) In that case, I think the right thing to do might be the following. Presumably this bug has been there forever. Comments? Index: Src/hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hist.c,v retrieving revision 1.46 diff -u -r1.46 hist.c --- Src/hist.c 11 Aug 2003 13:19:55 -0000 1.46 +++ Src/hist.c 19 Sep 2003 17:17:09 -0000 @@ -1091,9 +1091,16 @@ ptr = ztrdup(chline); if ((flag & (HISTFLAG_DONE | HISTFLAG_RECALL)) == HISTFLAG_DONE) { - zputs(ptr, shout); - fputc('\n', shout); - fflush(shout); + /* + * If fd 0 isn't a tty, we may not have a shout, even + * though the shell is interactive. Observed with + * Emacs shell mode, which makes the shell interactive + * explicitly. + */ + FILE *fout = shout ? shout : stdout; + zputs(ptr, fout); + fputc('\n', fout); + fflush(fout); } if (flag & HISTFLAG_RECALL) { zpushnode(bufstack, ptr); -- Peter Stephenson 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. **********************************************************************