zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Problems with the functions[] parameter (not; but other issues)
Date: Fri, 10 Mar 2000 13:45:50 +0100 (MET)	[thread overview]
Message-ID: <200003101245.NAA03786@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Fri, 10 Mar 2000 12:03:22 +0000


Bart Schaefer wrote:

> ...
> 

Interestingly, I just found the same two things, when changing
_diff_options.


> Which leads me to two observations ...
> 
> (1) autoloading the _call function (for example) is inefficient; it is
>     never used except in $(...), which means it is reloaded every time.
>     Would it be useful to use e.g.
> 
>     	#autoload +X
> 
>    at the top of such files?  To mean, "load this as soon as compinit
>    sees it, don't wait for it to be executed via $fpath."  (But what
>    would that mean for compdump?)

Yes, compdump is a problem, nice as it would be. I see only two ways:
make compinit/the-dump-file record the #autoloaded functions with the
options to #autoload in some array/assoc or add a naming convention
for files that are to be loaded immediatly. The first one would
support the nice `#autoload +X' you suggest and the latter would allow 
to get `#compdef' files loaded immediately without having to add an
extra option to compdef. Dunno if that's interesting to have for
#compdef files, though.

> (2) Redirecting stderr of a function is a bit inconsistent with respect
>     to xtrace.  Zsh presently works the same way bash does, which means
>     the xtrace output of shell functions is *not* redirected along with
>     their stderr.  This is not the same as e.g. `do'-loops and { ... }.

What really irritated me here (and it still looks wrong): add

  set -x
  _call version diff -v </dev/null 2>/dev/null
  set +x

to, say, _diff_option, then do `diff <TAB>'. At least I get:

  _diff_options:8 (): _call version diff -v
  _call:3 (): local tmp
  diff - GNU diffutils version 2.7-97r1
  _diff_options:9 (): set +x

Only the `first' line of _call is shown, xtrace output stops when
zstyle is called. Or maybe my exec.c is out-of date, because:

> And (2) in turn leads me to notice a third thing:
> 
> In bash, redirecting the standard error of the `.' command redirects
> the xtrace output from the commands in the sourced file.  This doesn't
> presently happen in zsh, but I think the zsh behavior is more useful;
> other opinions?  Is compatibility more important?  What does ksh do?

if I do `. ./foo 2> bar' I get the xtrace output of the commands in
`foo' in `bar'. Same as for the ksh I have here, btw.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-03-10 12:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-10 12:45 Sven Wischnowsky [this message]
2000-03-11 18:14 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-03-10  9:49 Problems with the functions[] parameter Sven Wischnowsky
2000-03-10 12:03 ` Problems with the functions[] parameter (not; but other issues) Bart Schaefer

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=200003101245.NAA03786@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --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).