zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Prompt expansion on signals
Date: Sun, 28 Nov 2021 22:10:55 +0100	[thread overview]
Message-ID: <54317-1638133855.690561@cAWR.fGbz.m1n1> (raw)
In-Reply-To: <CAN=4vMr8=AZWn0dte_UGJX2vRxkeAQMzVfVx1vvjEAp8h2q_Uw@mail.gmail.com>

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


  reply	other threads:[~2021-11-28 21:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28  9:59 Roman Perepelitsa
2021-11-28 19:50 ` Bart Schaefer
2021-11-28 20:31   ` Roman Perepelitsa
2021-11-28 21:10     ` Oliver Kiddle [this message]
2021-11-28 21:36       ` Roman Perepelitsa
2021-11-29  1:38     ` Bart Schaefer
2021-11-29 11:36       ` Roman Perepelitsa
2021-11-29 17:42         ` Roman Perepelitsa

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=54317-1638133855.690561@cAWR.fGbz.m1n1 \
    --to=opk@zsh.org \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).