zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: completion math functions from other modules
Date: Mon, 12 Nov 2018 03:00:57 +0100	[thread overview]
Message-ID: <63348-1541988057.524744@EV3P.cC_P.MVQ0> (raw)

_module_math_func currently only considers zsh/mathfunc. This extends it
to also check zsh/system as that also defines a math function (and, for
what it's worth, zsh/example).

Oliver

diff --git a/Completion/Zsh/Type/_module_math_func b/Completion/Zsh/Type/_module_math_func
index 6be9c006a..5044bdf4c 100644
--- a/Completion/Zsh/Type/_module_math_func
+++ b/Completion/Zsh/Type/_module_math_func
@@ -1,9 +1,12 @@
 #autoload
 
-local expl
-local -a funcs
+local mod
+local -a funcs alts
+local -a modules=( example mathfunc system )
 
-funcs=(${${${(f)"$(zmodload -Fl zsh/mathfunc 2>/dev/null)"}:#^+f:*}##+f:})
+for mod in $modules; do
+  funcs=( ${${${(f)"$(zmodload -Fl zsh/$mod 2>/dev/null)"}:#^+f:*}##+f:} )
+  alts+=( "module-math-functions.${mod}:math function from zsh/${mod}:compadd -S '(' $funcs" )
+done
 
-_wanted module-math-functions expl 'math function from zsh/mathfunc' \
-    compadd -S '(' -q "$@" -a funcs
+_alternative $alts

                 reply	other threads:[~2018-11-12  2:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=63348-1541988057.524744@EV3P.cC_P.MVQ0 \
    --to=okiddle@yahoo.co.uk \
    --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).