zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: improved completion in math context
@ 2013-03-15 21:42 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2013-03-15 21:42 UTC (permalink / raw)
  To: Zsh Hackers' List

Index: Completion/Zsh/Context/_math
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_math,v
retrieving revision 1.1
diff -p -u -r1.1 _math
--- Completion/Zsh/Context/_math	2 Apr 2001 11:23:46 -0000	1.1
+++ Completion/Zsh/Context/_math	15 Mar 2013 21:41:12 -0000
@@ -9,4 +9,6 @@ if [[ "$SUFFIX" = *[^a-zA-Z0-9_]* ]]; th
   SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}"
 fi
 
-_parameters -g '(integer|float)*' || _parameters
+_alternative 'integer-parameters:integer parameter: _math_params' \
+    'user-math-functions:user math function: _user_math_func' \
+    'module-math-functions:math function from zsh/mathfunc: _module_math_func'
Index: Completion/Zsh/Context/_zcalc_line
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_zcalc_line,v
retrieving revision 1.2
diff -p -u -r1.2 _zcalc_line
--- Completion/Zsh/Context/_zcalc_line	13 Jun 2008 14:27:37 -0000	1.2
+++ Completion/Zsh/Context/_zcalc_line	15 Mar 2013 21:41:12 -0000
@@ -13,7 +13,7 @@ _zcalc_line_escapes() {
     "eng:engineering (power of 1000) output format"
     "raw:raw output format"
     "local:make variables local"
-    "function:define math function"
+    "function:define math function (also \:func or \:f)"
   )
   cmds=("\:"${^cmds})
   _describe -t command-escapes "command escapes" cmds -Q
Index: Completion/Zsh/Type/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/.distfiles,v
retrieving revision 1.4
diff -p -u -r1.4 .distfiles
--- Completion/Zsh/Type/.distfiles	10 Nov 2008 15:28:42 -0000	1.4
+++ Completion/Zsh/Type/.distfiles	15 Mar 2013 21:41:12 -0000
@@ -15,10 +15,13 @@ _jobs
 _jobs_bg
 _jobs_fg
 _limits
+_math_params
+_module_math_func
 _options
 _options_set
 _options_unset
 _parameters
 _suffix_alias_files
+_user_math_func
 _vars
 '
Index: Completion/Zsh/Type/_math_params
===================================================================
RCS file: Completion/Zsh/Type/_math_params
diff -N Completion/Zsh/Type/_math_params
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Zsh/Type/_math_params	15 Mar 2013 21:41:12 -0000
@@ -0,0 +1,3 @@
+#autoload
+
+_parameters -g '(integer|float)*' || _parameters
Index: Completion/Zsh/Type/_module_math_func
===================================================================
RCS file: Completion/Zsh/Type/_module_math_func
diff -N Completion/Zsh/Type/_module_math_func
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Zsh/Type/_module_math_func	15 Mar 2013 21:41:12 -0000
@@ -0,0 +1,9 @@
+#autoload
+
+local expl
+local -a funcs
+
+funcs=(${${${(f)"$(zmodload -Fl zsh/mathfunc 2>/dev/null)"}:#^+f:*}##+f:})
+
+_wanted module-math-functions expl 'math function from zsh/mathfunc' \
+    compadd -S '(' "$@" -a funcs
Index: Completion/Zsh/Type/_user_math_func
===================================================================
RCS file: Completion/Zsh/Type/_user_math_func
diff -N Completion/Zsh/Type/_user_math_func
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Zsh/Type/_user_math_func	15 Mar 2013 21:41:12 -0000
@@ -0,0 +1,9 @@
+#autoload
+
+local expl
+local -a funcs
+
+funcs=(${${${(f)"$(functions -M)"}##functions -M }%% *})
+
+_wanted user-math-functions expl 'user math function' \
+    compadd -S '(' "$@" -a funcs

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-15 21:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15 21:42 PATCH: improved completion in math context Peter Stephenson

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).