From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11867 invoked from network); 7 Dec 2002 10:50:43 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 7 Dec 2002 10:50:43 -0000 Received: (qmail 5624 invoked by alias); 7 Dec 2002 10:50:27 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5570 Received: (qmail 5594 invoked from network); 7 Dec 2002 10:50:24 -0000 From: "Bart Schaefer" Message-Id: <1021207104956.ZM11288@candle.brasslantern.com> Date: Sat, 7 Dec 2002 10:49:56 +0000 In-Reply-To: <20021206155016.GA30834@cherry.fruitcom.com> Comments: In reply to Eric Smith "Re: autoexecuting command after a pause" (Dec 6, 4:50pm) References: <20021205214005.GB20225@cherry.fruitcom.com> <1021206102651.ZM10151@candle.brasslantern.com> <20021206155016.GA30834@cherry.fruitcom.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.dk Subject: Re: autoexecuting command after a pause MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Dec 6, 4:50pm, Eric Smith wrote: } } Like why press all the time? Maybe I set up some } (say) preexec() function for a certain shell to automatically } accept any types string on the command line if there has been } a pause of n milliseconds. } This is not for normal use but ad hoc. } } Make sense? Partly. By "there has been a pause of ..." you mean "something was typed at the prompt, but then the typing stopped and it was left unchanged for ...". What doesn't make sense to me is "not for normal use but ad hoc." If it isn't for normal use, what turns it on and off? And if you have to turn it on and off, how is that different from pressing enter? Putting that aside -- The way one would normally do this sort of thing is by setting the TMOUT parameter and installing a trap for the ALARM signal. However, that has only full second granularity, and you can't execute zle widgets from the trap unless it triggers while you're already in a zle widget, which by definition can't happen for TMOUT. (The trap must use `zle accept-line' to execute the contents of the editor buffer.) So I think you'd need to get zsh 4.1.0-dev-6 and use `zle -F' to install an alternate input handler, and then arrange (possibly by some external process) to write a byte on the handled descriptor. That wakes up zle and executes the handler in the appropriate context for calling widgets. I'm not interested enough to attempt to code it for you, but if you want to take a stab at it I'll be happy to critique it. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net