From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3996 invoked by alias); 5 Aug 2012 18:22:01 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17195 Received: (qmail 11064 invoked from network); 5 Aug 2012 18:21:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120805112132.ZM8095@torch.brasslantern.com> Date: Sun, 05 Aug 2012 11:21:32 -0700 In-reply-to: <671E3B65-DB7D-4C76-B617-18A7EAB28CB9@ucsc.edu> Comments: In reply to William Scott "Re: command completion notification" (Aug 4, 8:43pm) References: <61BB4B35-A02F-44F8-B793-A7F90543D25F@ucsc.edu> <120804161046.ZM14799@torch.brasslantern.com> <671E3B65-DB7D-4C76-B617-18A7EAB28CB9@ucsc.edu> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: command completion notification MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Aug 4, 8:43pm, William Scott wrote: } } > (2) It depends on what you want the binding to do. For example, to } > simply insert "tnot" in front of the current command and then run it: } > } > tnot-widget() { BUFFER="tnot $BUFFER"; zle accept-line } } > zle -N tnot-widget } } (2) worked like a charm, and am embarrassed since I read that chapter } in your book last night. You must mean Peter, Jerry and Oliver's book (credit where due). } Maybe I am taking a stupid approach. What would be ideal is if a user } could specify a time in seconds beyond which the notification would be } issued. I don't think there's anything particular wrong with the approach. You can check the shell variable $SECONDS before and after the command is run to see how much time has expired and only issue the notice if the difference is large enough. The example from last October does this by saving $SECONDS in preexec and the comparing it in precmd, but it can also be done entirely inside a wrapper like your tnot function.