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

Re: Prompt expansion on signals



Roman Perepelitsa wrote:
> I sometimes change prompt_* options in functions when I want to use `print -P`.
>
>     emulate -L zsh -o prompt_percent no_prompt_subst
>     print -Pru2 -- '%F{1}error%f: missing required parameter: %F{3}--foo%f'

In some cases, you might be better off using the ${(%)var} prompt
expansion. That sets prompt_percent and unsets prompt_subst and
prompt_bang for the expansion. ${(%%)var} uses current options.

> What do you think about not running signal handlers for SIGCHLD and
> SIGWINCH while zle widgets are running? Postpone them. This already
> sort of happens when a signal arrives during recursive-edit.

It isn't necessarily just hooks and signal handlers that are affected.
Someone might want to use emulate in a zle widget directly. If this is a
plugin, and the author uses default prompt options, it mightn't be clear
to them that this could break for other users.

There are some cases in completion too where it'd be useful to restore
the user's option settings for a particular command. Perhaps we could
have an argument to emulate - user or global perhaps - for restoring the
original options.

Making options sticky when PS1, PS2 etc are set might break someone's
setup where they set their prompt before their options.

Oliver




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