From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29729 invoked from network); 2 Oct 2001 23:26:26 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 2 Oct 2001 23:26:26 -0000 Received: (qmail 8365 invoked by alias); 2 Oct 2001 23:26:12 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4310 Received: (qmail 8352 invoked from network); 2 Oct 2001 23:26:10 -0000 From: Deborah Ariel Pickett Message-Id: <200110022325.JAA07306@bruce.csse.monash.edu.au> Subject: Re: get the number of active jobs to show in the prompt? To: vincent@vinc17.org (Vincent Lefevre) Date: Wed, 3 Oct 2001 09:25:57 +1000 (EST) Cc: zsh-users@sunsite.dk In-Reply-To: <20011002181324.A29201@greux.loria.fr> from "Vincent Lefevre" at Oct 02, 2001 06:13:24 PM X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Vincent wrote: > On Tue, Oct 02, 2001 at 15:43:13 +0000, Bart Schaefer wrote: > > There's no option to get that behavior because, in general, regenerating > > the prompt might change too much of the editor state. For example, what > > if you're editing at the secondary prompt (e.g., on the second or later > > line of a shell function or quoted string)? > I don't see the problem. Could you give an example? I thought the above paragraph *was* the example . . . OK, this example's not quite the same as Bart's, but it's close. Say you're in the middle of typing the following code: primary-prompt-with-job-info-in-it> for x in foo bar baz secondary-prompt> do secondary-prompt> echo ^ and the cursor is right there when a job finishes. What you seem to want is for zsh to instantly be interrupted and have it re-process the prompt. How? 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? You wouldn't want that to run again, because you haven't finished typing your command. I also believe that when you're typing a multi-line command like the one above, the individual lines that make it up aren't joined together into the command history as one command until the whole command is complete. (zsh developers, please correct me if I'm wrong.) Re-displaying the multi-line command thus isn't going to be easy. It certainly can't be done with user-level zsh programming. Yes, of course zsh could be modified to do what you want. Personally, I'd love it, because I was trying to do a similar thing a few months back, but I don't think it's very high on the zsh developers' list of priorities. (I'm not one of them, so correct me if I'm wrong.) (What I was trying a few months back was something that would set an alarm trap to go off in a few minutes, and catch it with a trap handler that would re-generate the prompt. It would then repeat the process, ensuring that the prompt was always up-to-date. Thus if I was away from my terminal I could see immediately how many messages were waiting for me by looking at the relevant part of the prompt. It didn't work, for the reasons Bart relates, so I just got in the habit of pressing ENTER to re-print the prompt when I came back to my machine. One extra keypress hasn't killed me.) -- Debbie Pickett http://www.csse.monash.edu.au/~debbiep debbiep@csse.monash.edu.au "Am I - d-dead?" "No." "We could fix that for you . . ." - _FernGully_