zsh-workers
 help / color / mirror / code / Atom feed
* posixism and unrelated spellcheck editing
@ 1999-11-30 23:22 Clint Adams
  1999-12-02 18:16 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 1999-11-30 23:22 UTC (permalink / raw)
  To: zsh-workers

I'm contemplating how to implement two features and they keep seeming
more and more complicated.

The first is POSIX options to the "command" builtin, basically
overloading it with a modified "whence" under EMULATE_SH or
perhaps when POSIX_BUILTINS is set and not otherwise.
It would be easier to differentiate the two meanings into
BINF_COMMAND and something else while parsing, but that doesn't
seem possible without some special handling.

So should BINF_COMMAND check to see if it's followed by
'-p', '-V', or '-v' and then modify its own cflags?

The other is something that will, upon an 'e' response to
sprompt, position the cursor at the point of the potential
error.  How to determine the position, where, and when?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: posixism and unrelated spellcheck editing
  1999-11-30 23:22 posixism and unrelated spellcheck editing Clint Adams
@ 1999-12-02 18:16 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1999-12-02 18:16 UTC (permalink / raw)
  To: zsh-workers

On Nov 30,  6:22pm, Clint Adams wrote:
} Subject: posixism and unrelated spellcheck editing
}
} The first is POSIX options to the "command" builtin, basically
} overloading it with a modified "whence" under EMULATE_SH or
} perhaps when POSIX_BUILTINS is set and not otherwise.

I don't think there's any way to "overload" in this way.  Precommand
modifiers are handled significantly differently; you can have either
the zsh behavior or the POSIX behavior, but not both.

} It would be easier to differentiate the two meanings into
} BINF_COMMAND and something else while parsing, but that doesn't
} seem possible without some special handling.

No, I don't recommend messing with this.

} So should BINF_COMMAND check to see if it's followed by
} '-p', '-V', or '-v' and then modify its own cflags?

No, definitely not.  That would require hacking up exec.c, which is the
wrong place to be dealing with this.

I suggest that you handle this by creating a "posix_command" module [1]
which, when zmodload'd, removes the "command" precommand modifier and
replaces it with its own "command" builtin.  (I think that's possible;
if it isn't I don't know why it shouldn't be.)

If you want to have the builtin from this module attempt to emulate the
zsh behavior in the case where none of '-p', '-V', or '-v' is set, it's
a bit harder.  I already struggled with this in eval_autoload() and came
up with a brute-force solution that won't work in the "command" case.
What's needed is a utility function to convert an argv directly into a
LinkNode list that could be stuffed into the `args' field of a Cmd.

[1] Maybe there's even reason enough to create a "posix" module that
does all sorts of posix-shell-compliant stuff.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-12-02 19:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-30 23:22 posixism and unrelated spellcheck editing Clint Adams
1999-12-02 18:16 ` Bart Schaefer

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).