about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-03 10:48:39 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-03 10:48:39 +0000
commit4777e2acd41ad06d172ff06e2ff989fdeee3e19b (patch)
tree53c0ec7aab30f9e1ad6cf618be54f0223e608c00
parent438a49c8d7a105b5e0b24eb3f658cad14df841c4 (diff)
downloadzsh-4777e2acd41ad06d172ff06e2ff989fdeee3e19b.tar.gz
zsh-4777e2acd41ad06d172ff06e2ff989fdeee3e19b.tar.xz
zsh-4777e2acd41ad06d172ff06e2ff989fdeee3e19b.zip
zsh-workers/8515
-rw-r--r--Completion/Base/_command_names2
-rw-r--r--Completion/Builtins/_bg_jobs2
-rw-r--r--Completion/Builtins/_fg_jobs3
-rw-r--r--Completion/Builtins/_hash3
-rw-r--r--Completion/Builtins/_jobs28
-rw-r--r--Completion/Builtins/_kill2
-rw-r--r--Completion/Builtins/_wait2
-rw-r--r--Completion/User/_gdb9
-rw-r--r--Completion/User/_perldoc2
-rw-r--r--Doc/Zsh/builtins.yo10
-rw-r--r--Src/Zle/comp.h2
-rw-r--r--Src/Zle/compctl.h2
-rw-r--r--Src/builtin.c2
-rw-r--r--Src/module.c16
14 files changed, 58 insertions, 27 deletions
diff --git a/Completion/Base/_command_names b/Completion/Base/_command_names
index a640e196b..5ec984bdc 100644
--- a/Completion/Base/_command_names
+++ b/Completion/Base/_command_names
@@ -15,7 +15,7 @@ fi
 
 # Complete jobs in implicit fg and bg
 if [[ -z "$ext" && "$PREFIX[1]" = "%" ]]; then
-  _job -P '%'
+  _jobs
   [[ nm -ne compstate[nmatches] ]] && return
 fi
 
diff --git a/Completion/Builtins/_bg_jobs b/Completion/Builtins/_bg_jobs
index 6d6a8fcc4..4362f8949 100644
--- a/Completion/Builtins/_bg_jobs
+++ b/Completion/Builtins/_bg_jobs
@@ -1,3 +1,3 @@
 #compdef bg
 
-_job -s -P '%'
+_jobs -s
diff --git a/Completion/Builtins/_fg_jobs b/Completion/Builtins/_fg_jobs
new file mode 100644
index 000000000..4db38045e
--- /dev/null
+++ b/Completion/Builtins/_fg_jobs
@@ -0,0 +1,3 @@
+#compdef disown fg jobs
+
+_jobs
diff --git a/Completion/Builtins/_hash b/Completion/Builtins/_hash
index c06d63699..4cb72b09c 100644
--- a/Completion/Builtins/_hash
+++ b/Completion/Builtins/_hash
@@ -10,7 +10,8 @@ if [[ "$words[2]" = -*d* ]]; then
     compadd "$expl[@]" -q -S '=' - "${(@k)nameddirs}"
   fi
 elif compset -P 1 '*\='; then
-  _files -/g '*(*)'
+  _description expl 'executable file'
+  _files "$expl[@]" -g '*(*)'
 else
   _description expl command
   compadd "$expl[@]" -q -S '=' - "${(@k)commands}"
diff --git a/Completion/Builtins/_jobs b/Completion/Builtins/_jobs
index c17b73c92..869aeeb8a 100644
--- a/Completion/Builtins/_jobs
+++ b/Completion/Builtins/_jobs
@@ -1,3 +1,27 @@
-#compdef disown fg jobs
+#autoload
+
+local expl disp jobs job jids
+
+if [[ "$1" = -r ]]; then
+  jids=( "${(@k)jobstates[(R)running*]}" )
+  shift
+  _description expl 'running job'
+elif [[ "$1" = -s ]]; then
+  jids=( "${(@k)jobstates[(R)running*]}" )
+  shift
+  _description expl 'suspended job'
+else
+  [[ "$1" = - ]] && shift
+  jids=( "${(@k)jobtexts}" )
+  _description expl job
+fi
+
+disp=()
+jobs=()
+for job in "$jids[@]"; do
+  disp=( "$disp[@]" "${(l:3:: ::%:)job} -- ${jobtexts[$job]}" )
+  jobs=( "$jobs[@]" "$job" )
+done
+
+compadd "$@" "$expl[@]" -ld disp - "%$^jobs[@]"
 
-_job -P '%'
diff --git a/Completion/Builtins/_kill b/Completion/Builtins/_kill
index b79bfd6c0..2af168f3f 100644
--- a/Completion/Builtins/_kill
+++ b/Completion/Builtins/_kill
@@ -8,7 +8,7 @@ if compset -P 1 -; then
 else
   local ret=1
 
-  _job && ret=0
+  _jobs && ret=0
 
   list=("${(@M)${(f@)$(ps ${=compconfig[ps_listargs]:-$=compconfig[ps_args]} 2>/dev/null)}[2,-1]:#[ 	]#${PREFIX}[0-9]#${SUFFIX}[ 	]*}")
   _description expl 'process ID'
diff --git a/Completion/Builtins/_wait b/Completion/Builtins/_wait
index 68ca187e8..b659532e7 100644
--- a/Completion/Builtins/_wait
+++ b/Completion/Builtins/_wait
@@ -2,7 +2,7 @@
 
 local list ret=1 expl
 
-_job -P '%' && ret=0
+_jobs && ret=0
 
 list=("${(@M)${(f)$(ps ${=compconfig[ps_listargs]:-$=compconfig[ps_args]} 2>/dev/null)}[2,-1]:#[ 	]#${PREFIX}[0-9]#${SUFFIX}[ 	]*}")
 _description expl 'process ID'
diff --git a/Completion/User/_gdb b/Completion/User/_gdb
index fc882ff90..22242caff 100644
--- a/Completion/User/_gdb
+++ b/Completion/User/_gdb
@@ -1,8 +1,5 @@
 #compdef gdb
 
-# This uses the configuration keys `ps_args' and `ps_listargs'
-# described in the `_wait' function.
-
 local cur="$words[CURRENT]" prev w list ret=1 expl
 
 [[ "$PREFIX" = --* ]] &&
@@ -17,7 +14,7 @@ elif compset -P '-tty='; then
   compadd "$expl[@]" - /dev/tty*
 elif compset -P '-(exec|se)='; then
   _description expl executable
-  _files "$expl[@]" -/g '*(*)'
+  _files "$expl[@]" -g '*(*)'
 elif compset -P '-(symbols|core|command)='; then
   _files
 elif [[ "$PREFIX" = -* ]]; then
@@ -33,7 +30,7 @@ else
   (-d) _files -/ && return 0 ;;
   (-[csx]) _files && return 0 ;;
   (-e) _description expl executable
-       _files "$expl[@]" -/g '*(*)' && return 0 ;;
+       _files "$expl[@]" -g '*(*)' && return 0 ;;
   (-b) _description -V expl 'baud rate'
        compadd "$expl[@]" 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 \
                           9600 19200 38400 57600 115200 230400 && return 0 ;;
@@ -53,6 +50,6 @@ else
     return ret
   else
     _description expl executable
-    _files "$expl[@]" -/g '*(*)'
+    _files "$expl[@]" -g '*(*)'
   fi
 fi
diff --git a/Completion/User/_perldoc b/Completion/User/_perldoc
index 54f0d9c08..62fd18ca7 100644
--- a/Completion/User/_perldoc
+++ b/Completion/User/_perldoc
@@ -21,7 +21,7 @@ _perl_pods () {
   _perl_basepods
 
   _description expl 'Perl modules and .pods'
-  _path_files "$expl[@]"  -/ -g '*.(pod|pm)'
+  _files "$expl[@]"  -g '*.(pod|pm)'
 
   [[ nm -ne "$compstate[nmatches]" ]]
 }
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 9bc83a380..9bc5b0a81 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1400,10 +1400,10 @@ of things implemented by modules.
 enditem()
 
 In a shell without dynamic loading only the tt(-e) option is
-supported. In such a shell the return status of tt(zmodload) without
-arguments or options is one whereas in a shell with dynamic loading
-the return status without arguments or options is always zero. This
-can be used to test if the shell supports dynamic loading of modules
-or not.
+supported and the tt(-i) option is ignored. In such a shell the return
+status of tt(zmodload) without arguments or options is one whereas in
+a shell with dynamic loading the return status without arguments or
+options is always zero. This can be used to test if the shell supports
+dynamic loading of modules or not.
 )
 enditem()
diff --git a/Src/Zle/comp.h b/Src/Zle/comp.h
index 6097f256c..59701608e 100644
--- a/Src/Zle/comp.h
+++ b/Src/Zle/comp.h
@@ -1,5 +1,5 @@
 /*
- * complete.h - header file for completion
+ * comp.h - header file for completion
  *
  * This file is part of zsh, the Z shell.
  *
diff --git a/Src/Zle/compctl.h b/Src/Zle/compctl.h
index 9a8ba5692..4dbc4862e 100644
--- a/Src/Zle/compctl.h
+++ b/Src/Zle/compctl.h
@@ -1,5 +1,5 @@
 /*
- * comp.h - header file for completion
+ * compctl.h - header file for completion
  *
  * This file is part of zsh, the Z shell.
  *
diff --git a/Src/builtin.c b/Src/builtin.c
index 3df653dcc..6f9b1dd57 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -127,7 +127,7 @@ static struct builtin builtins[] =
 #ifdef DYNAMIC
     BUILTIN("zmodload", 0, bin_zmodload, 0, -1, 0, "ILabcfdipue", NULL),
 #else
-    BUILTIN("zmodload", 0, bin_zmodload, 0, -1, 0, "e", NULL),
+    BUILTIN("zmodload", 0, bin_zmodload, 0, -1, 0, "ei", NULL),
 #endif
 };
 
diff --git a/Src/module.c b/Src/module.c
index e620073ce..9be11f195 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1251,9 +1251,9 @@ bin_zmodload_load(char *nam, char **args, char *ops)
 int
 bin_zmodload(char *nam, char **args, char *ops, int func)
 {
-    /* We understand only the -e option. */
+    /* We understand only the -e option (and ignore -i). */
 
-    if (ops['e']) {
+    if (ops['e'] || *args) {
 	LinkNode node;
 
 	if (!*args) {
@@ -1261,13 +1261,19 @@ bin_zmodload(char *nam, char **args, char *ops, int func)
 		nicezputs((char *) getdata(node), stdout);
 		putchar('\n');
 	    }
-	    return 0;
 	} else {
-	    for (; *args; args++)
+	    for (; *args; args++) {
 		for (node = firstnode(bltinmodules); node; incnode(node))
 		    if (!strcmp(*args, (char *) getdata(node)))
-			return 0;
+			break;
+		if (!node) {
+		    if (!ops['e'])
+			zerrnam(nam, "cannot load module: `%s'", *args, 0);
+		    return 1;
+		}
+	    }
 	}
+	return 0;
     }
     /* Otherwise we return 1 -- different from the dynamic version. */
     return 1;