zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _value
@ 1999-11-02 12:50 Tanaka Akira
  1999-11-02 14:05 ` Tanaka Akira
  0 siblings, 1 reply; 5+ messages in thread
From: Tanaka Akira @ 1999-11-02 12:50 UTC (permalink / raw)
  To: zsh-workers

I wrote _value to complete values for parameter assignments.

And I found a problem with this.  When I try the completion by _value
first time, it is failed and "funcstack wrapper with wrong function"
is displayed.  Since second time, there is no problem.

Z(2):akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% compconf group_matches=yes message_format='%d' description_format='%d'
is27e1u11% compconf describe_options=yes describe_values=yes option_prefix=yes
is27e1u11% A=<TAB>

->

is27e1u11% A=funcstack wrapper with wrong function

--- /dev/null	Tue Nov  2 21:12:50 1999
+++ Completion/Base/_value	Tue Nov  2 16:05:52 1999
@@ -0,0 +1,31 @@
+#compdef -value-
+
+_value () {
+  #_view_completion_parameters
+  if (( $+functions[_value:$compstate[parameter]] )); then
+    "_value:$compstate[parameter]" "$@"
+  else
+    _default
+  fi
+}
+
+_value:CPPFLAGS () {
+  compset -q
+  if compset -P '-I'; then
+    _files -/ "$@"
+  else
+    _default "$@"
+  fi
+}
+
+_value:LDFLAGS () {
+  compset -q
+  if compset -P '-L'; then
+    _files -/ "$@"
+  elif compset -P '-R'; then
+    compset -P '*:'
+    _files -/ -S/ -r ' :' "$@"
+  else
+    _default "$@"
+  fi
+}
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: _value
  1999-11-02 12:50 PATCH: _value Tanaka Akira
@ 1999-11-02 14:05 ` Tanaka Akira
  0 siblings, 0 replies; 5+ messages in thread
From: Tanaka Akira @ 1999-11-02 14:05 UTC (permalink / raw)
  To: zsh-workers

In article <rsqn1sxawgu.fsf@crane.jaist.ac.jp>,
  Tanaka Akira <akr@jaist.ac.jp> writes:

> I wrote _value to complete values for parameter assignments.

Oops. I forgot to call redefined _value at last.

Index: Completion/Base/_value
===================================================================
RCS file: /projects/zsh/zsh/Completion/Base/_value,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 _value
--- Completion/Base/_value	1999/11/02 12:51:20	1.1.1.1
+++ Completion/Base/_value	1999/11/02 14:04:31
@@ -29,3 +29,5 @@
     _default "$@"
   fi
 }
+
+_value "$@"
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: _value
@ 1999-11-02 15:11 Sven Wischnowsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Wischnowsky @ 1999-11-02 15:11 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> ...
>
> is27e1u11% A='Doc/z<TAB>
> ->
> is27e1u11% A='Docz 
> 
> and
> 
> is27e1u11% A='Doc/<TAB>
> ->
> is27e1u11% A='Doc
> 
> and
> 
> is27e1u11% LDFLAGS=-LDoc/<TAB>
> ->
> is27e1u11% LDFLAGS=-LDoc
> 
> These slashes shouldn't be removed...

Yep. Wrong cline tested... Disgusting.

Bye
 Sven

diff -u oldsrc/Zle/compcore.c Src/Zle/compcore.c
--- oldsrc/Zle/compcore.c	Tue Nov  2 14:52:25 1999
+++ Src/Zle/compcore.c	Tue Nov  2 16:08:58 1999
@@ -1887,7 +1887,7 @@
 		p = bld_parts(ppre, ppl, ppl, &lp);
 
 	    if (lp->prefix && !(line->flags & (CLF_SUF | CLF_MID)) &&
-		!p->llen && !p->wlen && !p->olen) {
+		!lp->llen && !lp->wlen && !lp->olen) {
 		Cline lpp;
 
 		for (lpp = lp->prefix; lpp->next; lpp = lpp->next);
@@ -1952,7 +1952,7 @@
 	    for (p = lp = cp_cline(pline, 1); lp->next; lp = lp->next);
 
 	if (lp->prefix && !(line->flags & (CLF_SUF | CLF_MID)) &&
-	    !p->llen && !p->wlen && !p->olen) {
+	    !lp->llen && !lp->wlen && !lp->olen) {
 	    Cline lpp;
 
 	    for (lpp = lp->prefix; lpp->next; lpp = lpp->next);

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: _value
  1999-11-02 13:00 Sven Wischnowsky
@ 1999-11-02 14:20 ` Tanaka Akira
  0 siblings, 0 replies; 5+ messages in thread
From: Tanaka Akira @ 1999-11-02 14:20 UTC (permalink / raw)
  To: zsh-workers

In article <199911021300.OAA31323@beta.informatik.hu-berlin.de>,
  Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:

> And thus the parameter module revealed a bug in the function calling
> code: it didn't dup the name and when the function was re-defined, the 
> name in use by the wrappers was freed.

Thanks.  But I found another problem.

Z:akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% compconf group_matches=yes message_format='%d' description_format='%d'
is27e1u11% compconf describe_options=yes describe_values=yes option_prefix=yes
is27e1u11% A='Doc/z<TAB>
->
is27e1u11% A='Docz 

and

is27e1u11% A='Doc/<TAB>
->
is27e1u11% A='Doc

and

is27e1u11% LDFLAGS=-LDoc/<TAB>
->
is27e1u11% LDFLAGS=-LDoc

These slashes shouldn't be removed...
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: _value
@ 1999-11-02 13:00 Sven Wischnowsky
  1999-11-02 14:20 ` Tanaka Akira
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 1999-11-02 13:00 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> I wrote _value to complete values for parameter assignments.
> 
> And I found a problem with this.  When I try the completion by _value
> first time, it is failed and "funcstack wrapper with wrong function"
> is displayed.  Since second time, there is no problem.

And thus the parameter module revealed a bug in the function calling
code: it didn't dup the name and when the function was re-defined, the 
name in use by the wrappers was freed.

Bye
 Sven

--- oldsrc/exec.c	Mon Nov  1 09:03:16 1999
+++ Src/exec.c	Tue Nov  2 13:57:30 1999
@@ -3018,7 +3018,7 @@
 		argzero = ztrdup(argzero);
 	    }
 	}
-	runshfunc(list, wrappers, name);
+	runshfunc(list, wrappers, dupstring(name));
 	if (retflag) {
 	    retflag = 0;
 	    breaks = obreaks;

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-11-02 15:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-02 12:50 PATCH: _value Tanaka Akira
1999-11-02 14:05 ` Tanaka Akira
1999-11-02 13:00 Sven Wischnowsky
1999-11-02 14:20 ` Tanaka Akira
1999-11-02 15:11 Sven Wischnowsky

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