Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] completion: Unison uses the $UNISON variable
- X-seq: zsh-workers 45649
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Henri Menke <henrimenke@xxxxxxxxx>
- Subject: Re: [PATCH] completion: Unison uses the $UNISON variable
- Date: Sun, 29 Mar 2020 20:29:40 +0000
- Cc: zsh-workers@xxxxxxx
- In-reply-to: <20200329041509.ao7tcppwp55qmmtu@worklaptop>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20200329041509.ao7tcppwp55qmmtu@worklaptop>
Henri Menke wrote on Sun, 29 Mar 2020 17:15 +1300:
> Please find attached my improvement for the Unison completion file.
> Details as to why this patch is necessary are in the commit message.
>
> If you need clarification or want me to improve the patch, please reply
> to me directly, as I am not subscribed to the list.
Thanks, applied.
Note that it will honour $UNISON even if that variable isn't exported.
I also have a further tweak:
8<--8<--
From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
Date: Sun, 29 Mar 2020 20:20:49 +0000
Subject: [PATCH] completion: Simplify Unison completion. No functional
change.
---
Completion/Unix/Command/_unison | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/Completion/Unix/Command/_unison b/Completion/Unix/Command/_unison
index d8cf7458f..5963d66c6 100644
--- a/Completion/Unix/Command/_unison
+++ b/Completion/Unix/Command/_unison
@@ -84,9 +84,6 @@ _arguments \
'*:profile:->profile'
if [[ $state == profile ]]; then
- local -a profiles
-
- profiles=( ${UNISON:-~/.unison}/*.prf(N) )
- (( $#profiles )) && \
- compadd "$@" - ${${profiles#${UNISON:-~/.unison}/}%.prf}
+ local -a profiles=( ${UNISON:-~/.unison}/*.prf(N:t:r) )
+ compadd "$@" -a profiles
fi
(Not trying to golf it, but to improve readability.)
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author