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 19:19:23 +0100	[thread overview]
Message-ID: <1183.1063995563@csr.com> (raw)
In-Reply-To: ""Dwight Shih""'s message of "Fri, 19 Sep 2003 12:54:43 CDT." <20030919175443.B24767835C@smtp.us2.messagingengine.com>

"Dwight Shih" wrote:
> But grepping about the
> source shows that shout is often treated as synonymous with interactive.
> For example, checkrmall will silently succeed if shout is null. Command
> correction (setopt correct) also just writes to shout. I think that we'd
> be better off setting shout whenever we have an interactive shell.

As long as we can rely on things not testing shout to see if there
terminal is set up... usually SHTTY is used for that purpose, so maybe
this is OK, but possibly we are increasing the danger from the existing
conflict of purposes between the various options, SHTTY and shout.

Other bits of the code seemd to think stderr rather than stdout was a
better substitute for shout, which is probably true.

It looks like the only place we need to be careful when closing shout is
the one in init, below.

Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.35
diff -u -r1.35 init.c
--- Src/init.c	3 Sep 2003 10:15:36 -0000	1.35
+++ Src/init.c	19 Sep 2003 18:13:57 -0000
@@ -379,7 +379,13 @@
 #endif
 
     if (shout) {
-	fclose(shout);
+	/*
+	 * Check if shout was set to stderr, if so don't close it.
+	 * We do this if we are interactive but don't have a
+	 * terminal.
+	 */
+	if (shout != stderr)
+	    fclose(shout);
 	shout = 0;
     }
     if (SHTTY != -1) {
@@ -448,9 +454,9 @@
 
     /* We will only use zle if shell is interactive, *
      * SHTTY != -1, and shout != 0                   */
-    if (interact && SHTTY != -1) {
+    if (interact) {
 	init_shout();
-	if(!shout)
+	if(!SHTTY || !shout)
 	    opts[USEZLE] = 0;
     } else
 	opts[USEZLE] = 0;
@@ -475,6 +481,14 @@
 init_shout(void)
 {
     static char shoutbuf[BUFSIZ];
+
+    if (SHTTY == -1)
+    {
+	/* Since we're interative, it's nice to have somewhere to write. */
+	shout = stderr;
+	return;
+    }
+
 #if defined(JOB_CONTROL) && defined(TIOCSETD) && defined(NTTYDISC)
     int ldisc = NTTYDISC;
 
Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.21
diff -u -r1.21 jobs.c
--- Src/jobs.c	2 May 2003 10:25:33 -0000	1.21
+++ Src/jobs.c	19 Sep 2003 18:13:57 -0000
@@ -322,8 +322,9 @@
 	}
     }
 
-    if (shout && !ttyfrozen && !jn->stty_in_env && !zleactive &&
-	job == thisjob && !somestopped && !(jn->stat & STAT_NOSTTY))
+    if (shout && shout != stderr && !ttyfrozen && !jn->stty_in_env &&
+	!zleactive && job == thisjob && !somestopped &&
+	!(jn->stat & STAT_NOSTTY)) 
 	gettyinfo(&shttyinfo);
 
     if (isset(MONITOR)) {

-- 
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 18:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20030919175443.B24767835C@smtp.us2.messagingengine.com>
2003-09-19 18:19 ` Peter Stephenson [this message]
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

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=1183.1063995563@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).