Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] completion: Unison uses the $UNISON variable



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