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

Re: get the number of active jobs to show in the prompt?

In article <200110022325.JAA07306@xxxxxxxxxxxxxxxxxxxxxxxx>,
   Deborah Ariel Pickett <debbiep@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

> What you seem to want is for zsh to instantly be interrupted and have it
> re-process the prompt.

> How?

The current command should be saved in a safe place. Then, the necessary
functions (e.g., precmd()) should be called. Finally, the current command
should be restored and displayed with the new prompt(s).

> Should it run precmd() again to do so?  What if there's stuff in
> precmd() that isn't to do with generating the prompt, but is instead
> involved in dealing with command history?

This is not a problem. When the user is typing a command (even if
multiline), the command isn't in the history yet.

> You wouldn't want that to run again, because you haven't finished typing
> your command.

Why not?

Or perhaps there should be two different functions: precmd(), which
should behave like now, and preprompt(), which should be run just
before the prompt is (re)displayed. Then, the code that modifies the
prompt should be in preprompt().

Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

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