Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bug in single_command



On Feb 11,  6:52pm, Richard Hartmann wrote:
}
} Quoting Doc/Zsh/options.yo for single_command:
} 
} The value of this option cannot be changed anywhere other than the
} command line.

I suggest changing "the command line" here to something like "in the
flags supplied at invocation of the shell" to match terminology that
is used elsewhere, e.g., the manual section "Invocation".

} My personal interpretation is that I can
} 
}   setopt single_command
} 
} which is obviously not correct.

It's true that "the command line" used elsewhere in the manual often
refers to the equivalent of the ZLE input buffer.  On the other hand,
it seems so obvious that "setopt single_command" would cause the shell
to immediately exit (after all, it has now executed a single command!)
that I hardly believe thsi is a source of significant confusion.

A better question might be why these options are not mentioned in the
"Invocation" section, since that's the only context in which they make
sense, rather than being relegated to the "Single Letter Options".

} Also, wouldn't it make sense to move errors into dosetopt() so the error
} messages could be more explicit about _why_ a setopt went wrong?

Without looking, I'd suspect that the reason is that dosetopt() may at
times be called from a context where emitting an error message is not
appropriate.  In general it's bad programming to spew to the standard
error stream at too low a level because it takes control away from the
caller.



Messages sorted by: Reverse Date, Date, Thread, Author