Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

WAD PRE_EXEC executed before PROMPT2

May
12,834
163
Code:
v:\> set prompt2
PROMPT2=$e[32;1m+$g$s$e[0m

v:\> alias pre_exec echo foo

v:\> do i=1 to 3 (
foo
+> echo %i )
1
2
3

v:\>
 
Last edited:
WAD.

PRE_EXEC is executed after the original line has been entered. The parser subsequently determines (much later) that the line is incomplete, and prompts for the remainder. If PRE_EXEC were delayed until the line continuation, it would break a LOT of existing functionality (including aliases). And it would require a significant parser rewrite -- for AFAICT no discernible benefit.
 
WAD.

PRE_EXEC is executed after the original line has been entered. The parser subsequently determines (much later) that the line is incomplete, and prompts for the remainder. If PRE_EXEC were delayed until the line continuation, it would break a LOT of existing functionality (including aliases). And it would require a significant parser rewrite -- for AFAICT no discernible benefit.
I'm surprised that you can't move the test that triggers the execution of PRE_EXEC to one (or more) more appropriate locations (namely, just before execution of the command).

Maybe its name should be changed (to, say, POST_ENTER), and its description changed to better reflect what it does.
 

Similar threads

Back
Top