zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: Re: closing stdin (Re: _make suppress error on OpenBSD.)
Date: Wed, 10 May 2000 10:22:31 +0000	[thread overview]
Message-ID: <1000510102231.ZM2598@candle.brasslantern.com> (raw)
In-Reply-To: <200005100720.JAA05611@beta.informatik.hu-berlin.de>

On May 10,  9:20am, Sven Wischnowsky wrote:
} Subject: Re: closing stdin (Re: _make suppress error on OpenBSD.)
}
} Bart Schaefer wrote:
} 
} > I've long forgotten (if I ever knew) why the stdin of ZLE functions is
} > closed.
} 
} This was done (by me) in 6484. For messages leading up to this, see:
} 6462 etc.

Oh, goody, so it was even my idea.  Sigh.

This should be documented somewhere (for both completion and widgets); I
just tried searching the docs for the string "close" starting at "Zsh Line
Editor" and except for a couple of times in "enclosed" it's not mentioned
until you hit Zftp.  It probably would have saved Peter some grief when
trying to answer that recent vi question on zsh-users.

These may not be the best places to mention it, but they were the closest
that I could find.

Index: Doc/Zsh/compwid.yo
===================================================================
@@ -12,22 +12,27 @@
 
 example(zle -C complete expand-or-complete completer)
 
-defines a widget named tt(complete). When this widget is bound to a key
-using the tt(bindkey) builtin command defined in the tt(zsh/zle) module
-(see 
-ifzman(zmanref(zshzle))\
-ifnzman(noderef(Zsh Line Editor))\
-), typing that key will call the shell function tt(completer). This
-function is responsible for generating the possible matches using the
-builtins described below. Once the function returns, the completion code
-takes over control again and treats the matches as the builtin widget
-tt(expand-or-complete) would do.  For this second argument, the name of any
-of the builtin widgets that handle completions can be given:
+defines a widget named `tt(complete)'.  The second argument is the name
+of any of the builtin widgets that handle completions:
 tt(complete-word), tt(expand-or-complete),
 tt(expand-or-complete-prefix), tt(menu-complete),
 tt(menu-expand-or-complete), tt(reverse-menu-complete),
 tt(list-choices), or tt(delete-char-or-list).  Note that this will still
 work even if the widget in question has been rebound.
+
+When this newly defined widget is bound to a key
+using the tt(bindkey) builtin command defined in the tt(zsh/zle) module
+(\
+ifzman(see zmanref(zshzle))\
+ifnzman(noderef(Zsh Line Editor))\
+), typing that key will call the shell function `tt(completer)'. This
+function is responsible for generating the possible matches using the
+builtins described below.  As with other ZLE widgets, the function is
+called with its standard input closed.
+
+Once the function returns, the completion code takes over control again
+and treats the matches in the same manner as the specified builtin
+widget, in this case tt(expand-or-complete).
 
 startmenu()
 menu(Special Parameters)
Index: Doc/Zsh/zle.yo
===================================================================
@@ -104,8 +104,10 @@
 User-defined widgets, being implemented as shell functions,
 can execute any normal shell command.  They can also run other widgets
 (whether built-in or user-defined) using the tt(zle) builtin command.
-They can use tt(read -k) or tt(read -q) to read characters from standard
-input.  Finally, they can examine and edit the ZLE buffer being edited by
+The standard input of the function is closed to prevent external commands
+from unintentionally blocking ZLE by reading from the terminal, but
+tt(read -k) or tt(read -q) can be used to read characters.  Finally,
+they can examine and edit the ZLE buffer being edited by
 reading and setting the special parameters described below.
 
 cindex(parameters, editor)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~2000-05-10 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-10  7:20 Sven Wischnowsky
2000-05-10 10:22 ` Bart Schaefer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-05-09 12:08 _make suppress error on OpenBSD Tanaka Akira
2000-05-09 19:34 ` closing stdin (Re: _make suppress error on OpenBSD.) Tanaka Akira
2000-05-10  4:48   ` Bart Schaefer
2000-05-10  7:22     ` Tanaka Akira

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=1000510102231.ZM2598@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.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).