zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: Bang completion kills zsh in emacs process buffer
Date: Fri, 19 Sep 2003 18:19:01 +0100	[thread overview]
Message-ID: <13065.1063991941@csr.com> (raw)
In-Reply-To: ""Dwight Shih""'s message of "Fri, 19 Sep 2003 12:02:25 CDT." <20030919170225.145F5757CF@smtp.us2.messagingengine.com>

"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 <pws@csr.com>                  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.
**********************************************************************


  reply	other threads:[~2003-09-19 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-19 15:38 Dwight Shih
2003-09-19 16:18 ` Peter Stephenson
2003-09-19 17:02   ` Dwight Shih
2003-09-19 17:19     ` Peter Stephenson [this message]
     [not found] <20030919175443.B24767835C@smtp.us2.messagingengine.com>
2003-09-19 18:19 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13065.1063991941@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).