From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15286 invoked by alias); 11 Feb 2015 17:07:27 -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: 19857 Received: (qmail 12175 invoked from network); 11 Feb 2015 17:07:26 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=x-sasl-enc:date:from:to:subject:message-id :references:mime-version:content-type:in-reply-to; s=mesmtp; bh= 5yl8S3N5kc8xEe1fjAboVL0n5eA=; b=V58S0QsZYhB+u4qnRzQIm87DA3/oBK5D z5U9F2MK53V31d6qj6q+4LecWLdXYuwhhEkIVLKuf5nkxY8GuqUTS8KVv57RT8Yq 0Ec7WZzW5/CcoRu4WseJIcbhtXqum09mGaL6O7tSd4Zpc7pijbsooY4tH+fS9idR skU/0qOvcNg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:date:from:to:subject :message-id:references:mime-version:content-type:in-reply-to; s= smtpout; bh=5yl8S3N5kc8xEe1fjAboVL0n5eA=; b=BQVFMDle2e5XSSfIZoxJ ochur+QyX1oadI4S1oXqgmJJHAgGQJxAVP1eQXKkaH1oLGcwxM2J/GFA31N6IFk8 wZcuy4ta6z4ZkyqfCkBJc1ETSTcwYYW1naQY20JTji39RlIP5/sOkuGmBOhzoT6D mxb+MNu9ajyoWVIEhXnV3wI= X-Sasl-enc: 3zik7VIq8bGr57PUqqjajJ5bJk3LvuTxAG8H+58IKOqF 1423673785 Date: Wed, 11 Feb 2015 16:56:18 +0000 From: Daniel Shahaf To: zsh-users@zsh.org Subject: Re: exclude users in watch variable? Message-ID: <20150211165618.GA5230@tarsus.local2> References: <20150204174605.GA14529@spiegl.de> <20150210192857.GA13932@spiegl.de> <20150210214551.GC1829@tarsus.local2> <20150211114654.GA22015@spiegl.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150211114654.GA22015@spiegl.de> User-Agent: Mutt/1.5.21 (2010-09-15) Andy Spiegl wrote on Wed, Feb 11, 2015 at 12:46:55 +0100: > > For an alternative I'd suggest writing a custom precmd. > Thanks for the suggestion. I started to think about how to implement > this but came to the conclusion that my zsh knowledge is not good > enough for this. :-( I could write a perl script but in precmd ... No! > > Could one of you zsh cracks give me a good start, please? > Like this? --- autoload -Uz add-zsh-hook old= precmd_who() { local new="$(who)"$'\n' # add newline to reduce spurious diffs if [[ -n $old ]] ; then diff =(<<<$old) =(<<<$new) ; fi old=$new } add-zsh-hook precmd precmd_who If 'who' doesn't run quickly in your environment you'll notice delays before shell prompts are drawn. The variable 'old' is in the global namespace, you should probably name it something more unique to avoid name collisions. Daniel