On Mon, Jan 25, 2021 at 11:16:25AM +0300, Arseny Maslennikov wrote: > The Zsh documentation at Doc/Zsh/contrib, paragraph 26.6.4 "Writing > Themes", says: > > Declare cleanup > > If your function makes any other changes that should be undone when > the theme is disabled, your setup function may call > > prompt_cleanup command > > where command should be suitably quoted. If your theme is ever > disabled or replaced by another, command is executed with eval. You > may declare more than one such cleanup hook. > > The promptinit framework fails to apply cleanup commands of the current > theme on any theme change other than "prompt restore", as well as when > invoking setup functions of a certain $theme as an implementation detail > of `prompt -[hp] $theme'. > > This problem was previously brought up in zsh-users/23314, to no avail. > > We fix it in the following way, hopefully without breaking compatibility: > * Rename zstyle `cleanup' on the context `:prompt-theme' to `restore' > everywhere but in prompt_cleanup(). It is only used as a restore > mechanism now. > * Ensure prompt_cleanup() continues to store its command list in the > `cleanup' style. > * Clean up before theme switch at the end of set_prompt(). > * Prepend every use of prompt_*_setup (which might modify the shell > state in ways that require cleanup) with a cleanup run. > * Adjust `prompt restore' to do both parts of the newly split restore > mechanism, cleanup first. > --- > Functions/Prompts/prompt_restore_setup | 1 + > Functions/Prompts/promptinit | 43 ++++++++++++++++++-------- > 2 files changed, 31 insertions(+), 13 deletions(-) Could someone please look at this series?
Attachment:
signature.asc
Description: PGP signature