Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: exclude users in watch variable?
- X-seq: zsh-users 19857
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: exclude users in watch variable?
- Date: Wed, 11 Feb 2015 16:56:18 +0000
- 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=
- In-reply-to: <20150211114654.GA22015@spiegl.de>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20150204174605.GA14529@spiegl.de> <20150210192857.GA13932@spiegl.de> <20150210214551.GC1829@tarsus.local2> <20150211114654.GA22015@spiegl.de>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author