zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Henri Menke <henrimenke@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] completion: Unison uses the $UNISON variable
Date: Sun, 29 Mar 2020 20:29:40 +0000	[thread overview]
Message-ID: <20200329202940.04cf1ae5@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <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@daniel.shahaf.name>
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

      reply	other threads:[~2020-03-29 20:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29  4:15 Henri Menke
2020-03-29 20:29 ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200329202940.04cf1ae5@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=henrimenke@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).