zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: User-defined completion listing
@ 1997-11-19 17:00 Peter Stephenson
  1997-11-19 19:41 ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Stephenson @ 1997-11-19 17:00 UTC (permalink / raw)
  To: Zsh hackers list, zsh

This implements something like the outcome of the recent discussion of
a new option for showing a user-defined list instead of the actual
completions.  First, the bad news: this patch is simply against my own
current adaption of 3.1.2, which probably doesn't correspond to anyone
else's.  In particular, it has my compctl -/ and -W patches in, but it
doesn't have Sven's big patch, which may make a difference.  I could
probably do it against vanilla 3.1.2 if that becomes sensible.

Now the good news:  the syntax (see manual patch for more) is either

  compctl ... -Y '$array'

or

  compctl ... -Y 'func'

In the first case, $array is, err, an array, in the second, func is
called and must set $reply, just like a -K function.  (They're
evaluated at different times, so there's no clash.)  func is also
passed the complete list of matches, with full prefix expansion, so it
can process the matches to produce a display. For example,

  llfn() { reply=("$(ls -fld $*)"); }
  compctl -f -Y llfn foo

foo has ordinary file name completion, but the list of matches will be
made line by line in ls -l format.  read -c and read -l are available
if you want them.

The output is literal in this case, since you have control over what
comes out, though only newline is specially handled; other control
sequences could mess up the formatting and are best avoided (at least
with always_last_prompt set).  Note, however, that all the other
formatting capabilities are retained, so a -Y function like

  func() { reply=($*); }

produces full columnated output just as without the -Y func (assuming
there are no funny characters in the $* which would be massaged in
that case).

So the suggestion for job completion is along the lines of:

  joblist() {
      local jf=/tmp/zjobs$$ line
      jobs >& $jf
      reply=() joblist=()
      while read line; do
  	  joblist=($joblist $line)
  	  reply=($reply ${${line#\[}%%\]*})
      done < $jf
  # The above allows the output to appear in columns.  If you want the
  # exact output of 'jobs', you can instead use:
  #    joblist=("$(<$jf)")
  # It must still be an array, though.
      rm -f $jf
  }
  compctl -P% -K joblist -Y '$joblist' \
      -x 's[-]' -k signals -- kill   # ... and friends

Note that in the current implementation you need a completion list: if
there are no completions, nothing is displayed, so you can't just
display a memo and let the user complete by hand.  That could probably
be remedied.  Obviously, '$joblist' could be a static variable as well.

One thing to check for with the patch is that I haven't somehow gummed
up the logic for displaying other types of completion in my zeal to
get -Y displays to appear OK; I obviously couldn't check everything
directly myself.  (I think I caught the only memory leak, though.)
Also, a -Y func is blindly passed the fully expanded completion
possibilities (necessary for the llfn example above, which needs the
full path to the candidate file): maybe there are occasions where
that's wrong.

Another thing under the `could perhaps be better, but it's time I did
some work' heading:  literal arrays are allowed as with -k, i.e. -Y
'(option1 option2 ...)', but there's no way of getting a literal
string there.  It might be nice to enhance get_user_var() to understand
a double quote at the beginning and return the text as an array with a
single element.  (The name of a real array with just one element is
fine, of course.)

While I'm getting picky:  the fact that the completion function gets
the full path could be something of a memory hog if you are completing
in a full directory with a long path name, but until the Commodore 64
version of zsh appears...

*** Doc/Zsh/compctl.yo.YoY	Thu Sep 18 09:58:39 1997
--- Doc/Zsh/compctl.yo	Wed Nov 19 17:34:51 1997
***************
*** 103,111 ****
    [ tt(-s) var(subststring) ])
  list([ tt(-K) var(function) ] [ tt(-H) var(num pattern) ])
  list([ tt(-Q) ] [ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ])
! liat([ tt(-W) var(file-prefix) ]
  list([ tt(-q) ] [ tt(-X) var(explanation) ])
! list([ tt(-l) var(cmd) ] [ tt(-U) ])
  endlist()
  
  The remaining var(options) specify the type of command arguments
--- 103,111 ----
    [ tt(-s) var(subststring) ])
  list([ tt(-K) var(function) ] [ tt(-H) var(num pattern) ])
  list([ tt(-Q) ] [ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ])
! list([ tt(-W) var(file-prefix) ])
  list([ tt(-q) ] [ tt(-X) var(explanation) ])
! list([ tt(-Y) var(func-or-var) ] [ tt(-l) var(cmd) ] [ tt(-U) ])
  endlist()
  
  The remaining var(options) specify the type of command arguments
***************
*** 360,365 ****
--- 360,385 ----
  options. A `tt(%n)' in this string is replaced by the number of matches.
  The explanation only appears if completion was tried and there was
  no unique match.
+ )
+ item(tt(-Y) var(func-or-var))(
+ The list provided by var(func-or-var) is displayed instead of the list
+ of completions whenever a listing is required; the actual completions
+ to be inserted are not affected.  It can be provided in two
+ ways. Firstly, if var(func-or-var) begins with a tt($) it defines an
+ array variable, or if it begins with a left parenthesis a literal
+ array, which contains the list.  A variable may have been set by a
+ call to a function using the tt(-K) option.  Otherwise it contains the
+ name of a function which will be executed to create the list.  The
+ function will be passed as an argument list all matching completions,
+ including prefixes and suffixes expanded in full, and should set the
+ array var(reply) to the result.  In both cases, the display list will
+ only be retrieved after a complete list of matches has been created.
+ 
+ Note that the returned list does not have to correspond, even in
+ length, to the original set of matches; the use of an array is purely
+ a convenience for formatting.  No special formatting of characters is
+ performed on the output in this case; in particular, newlines are
+ printed literally and if they appear output in columns is suppressed.
  )
  enditem()
  texinode(Alternative Completion)(Extended Completion)(Option Flags)(Programmable Completion)
*** Src/Zle/comp.h.YoY	Thu Sep 18 09:58:39 1997
--- Src/Zle/comp.h	Wed Nov 19 11:45:01 1997
***************
*** 102,107 ****
--- 102,108 ----
      char *str;			/* for -s (expansion)                      */
      char *func;			/* for -K (function)                       */
      char *explain;		/* for -X (explanation)                    */
+     char *ylist;		/* for -Y (user-defined desc. for listing) */
      char *prefix, *suffix;	/* for -P and -S (prefix, suffix)          */
      char *subcmd;		/* for -l (command name to use)            */
      char *withd;		/* for -w (with directory                  */
*** Src/Zle/comp1.c.YoY	Thu Sep 18 09:58:40 1997
--- Src/Zle/comp1.c	Wed Nov 19 12:18:44 1997
***************
*** 80,85 ****
--- 80,86 ----
      zsfree(cc->str);
      zsfree(cc->func);
      zsfree(cc->explain);
+     zsfree(cc->ylist);
      zsfree(cc->prefix);
      zsfree(cc->suffix);
      zsfree(cc->hpat);
*** Src/Zle/compctl.c.YoY	Thu Sep 18 09:59:17 1997
--- Src/Zle/compctl.c	Wed Nov 19 12:18:41 1997
***************
*** 217,222 ****
--- 217,234 ----
  		    *argv = "" - 1;
  		}
  		break;
+ 	    case 'Y':
+ 		if ((*argv)[1]) {
+ 		    cct.ylist = (*argv) + 1;
+ 		    *argv = "" - 1;
+ 		} else if (!argv[1]) {
+ 		    zwarnnam(name, "function/variable expect after -%c",
+ 			     NULL, **argv);
+ 		} else {
+ 		    cct.ylist = *++argv;
+ 		    *argv = "" - 1;
+ 		}
+ 		break;
  	    case 'P':
  		if ((*argv)[1]) {
  		    cct.prefix = (*argv) + 1;
***************
*** 687,693 ****
      Compctl cc;
  
      if (cct->subcmd && (cct->keyvar || cct->glob || cct->str ||
! 			cct->func || cct->explain || cct->prefix)) {
  	zwarnnam(name, "illegal combination of options", NULL, 0);
  	return 1;
      }
--- 699,706 ----
      Compctl cc;
  
      if (cct->subcmd && (cct->keyvar || cct->glob || cct->str ||
! 			cct->func || cct->explain || cct->ylist ||
! 			cct->prefix)) {
  	zwarnnam(name, "illegal combination of options", NULL, 0);
  	return 1;
      }
***************
*** 725,730 ****
--- 738,744 ----
      zsfree(cc->str);
      zsfree(cc->func);
      zsfree(cc->explain);
+     zsfree(cc->ylist);
      zsfree(cc->prefix);
      zsfree(cc->suffix);
      zsfree(cc->subcmd);
***************
*** 740,745 ****
--- 754,760 ----
      cc->str = ztrdup(cct->str);
      cc->func = ztrdup(cct->func);
      cc->explain = ztrdup(cct->explain);
+     cc->ylist = ztrdup(cct->ylist);
      cc->prefix = ztrdup(cct->prefix);
      cc->suffix = ztrdup(cct->suffix);
      cc->subcmd = ztrdup(cct->subcmd);
***************
*** 857,862 ****
--- 872,878 ----
      printif(cc->keyvar, 'k');
      printif(cc->func, 'K');
      printif(cc->explain, 'X');
+     printif(cc->ylist, 'Y');
      printif(cc->prefix, 'P');
      printif(cc->suffix, 'S');
      printif(cc->glob, 'g');
*** Src/Zle/zle_tricky.c.YoY	Thu Sep 18 10:01:00 1997
--- Src/Zle/zle_tricky.c	Wed Nov 19 17:46:32 1997
***************
*** 123,128 ****
--- 123,133 ----
  
  static int nmatches;
  
+ /* A list of user-defined explanations for the completions to be shown *
+  * instead of amatches when listing completions.                       */
+ 
+ static char **aylist;
+ 
  /* !=0 if we have a valid completion list. */
  
  static int validlist;
***************
*** 2996,3003 ****
      ccsuffix = cc->suffix;
  
      validlist = 1;
!     if ((nmatches || expl) && !errflag)
  	return 0;
  
      if ((isf || cc->xor) && !parampre) {
  	/* We found no matches, but there is a xor'ed completion: *
--- 3001,3045 ----
      ccsuffix = cc->suffix;
  
      validlist = 1;
!     if ((nmatches || expl) && !errflag) {
! 	/* generating the user-defined explanations must happen last: *
! 	 * if anything fails, we silently allow the normal completion *
! 	 * list to be used.                                           */
! 	if (cc->ylist) {
! 	    char **yaptr, *uv = NULL;
! 	    List list;
! 
! 	    if (cc->ylist[0] == '$' || cc->ylist[0] == '(') {
! 		/* from variable: must be an array */
! 		uv = cc->ylist + (cc->ylist[0] == '$');
! 	    } else if ((list = getshfunc(cc->ylist)) != &dummy_list) {
! 		/* from function:  pass completions as arg list */
! 		LinkList args = newlinklist();
! 		int addlen = strlen(rpre) + strlen(rsuf) + 1;
! 
! 		addlinknode(args, cc->ylist);
! 		for (yaptr = amatches; *yaptr; yaptr++) {
! 		    /* can't use tricat(). rats. */
! 		    char *ptr = (char *)halloc(addlen + strlen(*yaptr));
! 		    sprintf(ptr, "%s%s%s", rpre, *yaptr, rsuf);
! 		    addlinknode(args, ptr);
! 		}
! 
! 		/* No harm in allowing read -l and -c here, too */
! 		incompctlfunc = 1;
! 		doshfunc(list, args, 0, 1);
! 		incompctlfunc = 0;
! 		uv = "reply";
! 	    } else
! 		return 0;
! 	    if (uv && (yaptr = get_user_var(uv))) {
! 		PERMALLOC {
! 		    aylist = arrdup(yaptr);
! 		} LASTALLOC;
! 	    }
! 	}
  	return 0;
+     }
  
      if ((isf || cc->xor) && !parampre) {
  	/* We found no matches, but there is a xor'ed completion: *
***************
*** 3045,3050 ****
--- 3087,3095 ----
  	listmatches();
      if(validlist) {
  	freearray(amatches);
+ 	if (aylist)
+ 	    freearray(aylist);
+ 	aylist = 0;
  	zsfree(rpre);
  	zsfree(rsuf);
  	zsfree(lpre);
***************
*** 3516,3526 ****
  listmatches(void)
  {
      int longest = 1, fct, fw, colsz, t0, t1, ct, up, cl, xup = 0;
!     int off, boff, nboff;
!     int of = (isset(LISTTYPES) && !(haswhat & HAS_MISC));
      char **arr, **ap, sav;
      int nfpl, nfsl, nlpl, nlsl;
!     int listmax = getiparam("LISTMAX");
  
  #ifdef DEBUG
      /* Sanity check */
--- 3561,3572 ----
  listmatches(void)
  {
      int longest = 1, fct, fw, colsz, t0, t1, ct, up, cl, xup = 0;
!     int off = 0, boff = 0, nboff = 0;
!     int of = (!aylist && isset(LISTTYPES) && !(haswhat & HAS_MISC));
      char **arr, **ap, sav;
      int nfpl, nfsl, nlpl, nlsl;
!     int listmax = getiparam("LISTMAX"), litnl = 0;
!     size_t (*strlenfn) _((char const *));
  
  #ifdef DEBUG
      /* Sanity check */
***************
*** 3538,3549 ****
  
      /* Calculate the lengths of the prefixes/suffixes we have to ignore
         during printing. */
!     off = ispattern && ppre && *ppre &&
! 	!(haswhat & (HAS_MISC | HAS_PATHPAT)) ? strlen(ppre) : 0;
!     boff = ispattern && psuf && *psuf &&
! 	!(haswhat & (HAS_MISC | HAS_PATHPAT)) ? strlen(psuf) : 0;
!     nboff = ispattern && psuf && *psuf &&
! 	!(haswhat & (HAS_MISC | HAS_PATHPAT)) ? niceztrlen(psuf) : 0;
  
      /* When called from expandorcompleteprefix, we probably have to
         remove a space now. */
--- 3584,3597 ----
  
      /* Calculate the lengths of the prefixes/suffixes we have to ignore
         during printing. */
!     if (ispattern && !aylist && !(haswhat & (HAS_MISC | HAS_PATHPAT))) {
! 	if (ppre && *ppre)
! 	    off = strlen(ppre);
! 	if (psuf && *psuf) {
! 	    boff = strlen(psuf);
! 	    nboff = niceztrlen(psuf);
! 	}
!     }
  
      /* When called from expandorcompleteprefix, we probably have to
         remove a space now. */
***************
*** 3558,3595 ****
  
      /* Set the cursor below the prompt. */
      trashzle();
-     ct = nmatches;
      showinglist = 0;
  
      clearflag = (isset(USEZLE) && !termflags &&
  		 (isset(ALWAYSLASTPROMPT) && zmult == 1)) ||
  	(unset(ALWAYSLASTPROMPT) && zmult != 1);
  
!     arr = amatches;
  
!     /* Calculate the column width, the number of columns and the number
!        of lines. */
!     for (ap = arr; *ap; ap++)
! 	if ((cl = niceztrlen(*ap + off) - nboff +
! 	     (ispattern ? 0 :
! 	      (!(haswhat & HAS_MISC) ? nfpl + nfsl : nlpl + nlsl))) > longest)
! 	    longest = cl;
!     if (of)
! 	longest++;
! 
!     fw = longest + 2;
!     fct = (columns + 1) / fw;
!     if (fct == 0) {
! 	fct = 1;
! 	colsz = ct;
! 	up = colsz + nlnct - clearflag;
  	for (ap = arr; *ap; ap++)
! 	    up += (niceztrlen(*ap + off) - nboff + of +
! 		(ispattern ? 0 :
! 		(!(haswhat & HAS_MISC) ? nfpl + nfsl : nlpl + nlsl))) / columns;
!     } else {
! 	colsz = (ct + fct - 1) / fct;
! 	up = colsz + nlnct - clearflag + (ct == 0);
      }
  
      /* Print the explanation string, if any. */
--- 3606,3683 ----
  
      /* Set the cursor below the prompt. */
      trashzle();
      showinglist = 0;
  
      clearflag = (isset(USEZLE) && !termflags &&
  		 (isset(ALWAYSLASTPROMPT) && zmult == 1)) ||
  	(unset(ALWAYSLASTPROMPT) && zmult != 1);
  
!     /* just to keep gcc happy */
!     fw = colsz = up = 0;
!     if (aylist) {
! 	arr = aylist;
! 	/* If no literal newlines, the remaining code should use strlen() */
! 	strlenfn = (size_t (*) _((char const *)))strlen;
! 
! 	/* The hard bit here is that we are handling newlines literally.   *
! 	 * In fact, we are in principle handling all characters literally, *
! 	 * but it's quite enough work with just newlines.                  *
! 	 * If there are such, we give up trying to print the list as       *
! 	 * columns and print as rows, counting the extra newlines.         */
! 	ct = 0;
! 	for (ap = arr; *ap; ap++) {
! 	    ct++;
! 	    if (strchr(*ap, '\n'))
! 		litnl++;
! 	}
! 	if (litnl) {
! 	    colsz = ct;
! 	    up = colsz + nlnct - clearflag;
! 	    /* Count real newlines, as well as overflowing lines. */
! 	    for (ap = arr; *ap; ap++) {
! 		char *nlptr, *sptr = *ap;
! 		while (sptr && *sptr) {
! 		    up += (nlptr = strchr(sptr, '\n'))
! 			? 1 + (nlptr-sptr)/columns
! 			   : strlen(sptr)/columns;
! 		    sptr = nlptr ? nlptr+1 : NULL;
! 		}
! 	    }
! 	}
!     } else {
! 	arr = amatches;
! 	ct = nmatches;
! 	strlenfn = niceztrlen;
!     }
  
! 
!     if (!litnl) {
! 	/* Calculate the column width, the number of columns and the
! 	   number of lines. */
  	for (ap = arr; *ap; ap++)
! 	    if ((cl = strlenfn(*ap + off) - nboff +
! 		 ((ispattern || aylist) ? 0 :
! 		  (!(haswhat & HAS_MISC) ?
! 		   nfpl + nfsl : nlpl + nlsl))) > longest)
! 		longest = cl;
! 	if (of)
! 	    longest++;
! 
! 	fw = longest + 2;
! 	fct = (columns + 1) / fw;
! 	if (fct == 0) {
! 	    fct = 1;
! 	    colsz = ct;
! 	    up = colsz + nlnct - clearflag;
! 	    for (ap = arr; *ap; ap++)
! 		up += (strlenfn(*ap + off) - nboff + of +
! 		       ((ispattern || aylist) ? 0 :
! 			(!(haswhat & HAS_MISC) ?
! 			 nfpl + nfsl : nlpl + nlsl))) / columns;
! 	} else {
! 	    colsz = (ct + fct - 1) / fct;
! 	    up = colsz + nlnct - clearflag + (ct == 0);
! 	}
      }
  
      /* Print the explanation string, if any. */
***************
*** 3671,3677 ****
  	    while (*ap) {
  		int t2;
  
! 		if (ispattern) {
  		    int cut = strlen(*ap) - boff;
  
  		    sav = ap[0][cut];
--- 3759,3768 ----
  	    while (*ap) {
  		int t2;
  
! 		if (aylist) {
! 		    zputs(*ap, shout);
! 		    t2 = strlen(*ap);		    
! 		} else if (ispattern) {
  		    int cut = strlen(*ap) - boff;
  
  		    sav = ap[0][cut];

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, Platanenallee 6, 15738 Zeuthen, Germany.


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

* Re: User-defined completion listing
  1997-11-19 17:00 PATCH: User-defined completion listing Peter Stephenson
@ 1997-11-19 19:41 ` Bart Schaefer
  1997-11-20  9:22   ` Peter Stephenson
  0 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 1997-11-19 19:41 UTC (permalink / raw)
  To: Zsh hackers list

On Nov 19,  6:00pm, Peter Stephenson wrote:
} Subject: PATCH: User-defined completion listing
}
} Now the good news:  the syntax (see manual patch for more) is either
} 
}   compctl ... -Y '$array'
} or
}   compctl ... -Y 'func'
} 
} In the first case, $array is, err, an array, in the second, func is
} called and must set $reply, just like a -K function.

I must confess confusion as to why you'd do it this way.

If you're going to examine the first character and behave differently
when it is '$', you could do that with -X and not need a new option.

If you're going to expand a variable, why does it have to be an array?
The parameter to -X is just a string.

If you're going to substitute a string, why pass it around with $reply?

} Another thing under the `could perhaps be better, but it's time I did
} some work' heading:  literal arrays are allowed as with -k, i.e. -Y
} '(option1 option2 ...)', but there's no way of getting a literal
} string there.

Why do you need to pass a literal string to -Y when you can use -X ?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: User-defined completion listing
  1997-11-19 19:41 ` Bart Schaefer
@ 1997-11-20  9:22   ` Peter Stephenson
  1997-11-20 13:39     ` PATCH: allow scalars as completion variables Peter Stephenson
  1997-11-20 16:57     ` User-defined completion listing Bart Schaefer
  0 siblings, 2 replies; 9+ messages in thread
From: Peter Stephenson @ 1997-11-20  9:22 UTC (permalink / raw)
  To: Zsh hackers list

"Bart Schaefer" wrote:
> }   compctl ... -Y '$array'
> } or
> }   compctl ... -Y 'func'
> 
> I must confess confusion as to why you'd do it this way.
> 
> If you're going to examine the first character and behave differently
> when it is '$', you could do that with -X and not need a new option.

-X doesn't do the right thing.  It gets displayed with completions,
if there's no unique match, not just listings.  Further, it gets displayed
in addition to a listing, just above.  We want something to be displayed
instead of a listing.  If you simply use -X, there's no way of adapting
the listing at all, and it would be wrong to misuse -X for that
purpose.  Also, -Y *has* to be generated separately for each
completion, because it depends on the actual list; -X doesn't, so
there's no real rationale for making it support $var.

> If you're going to expand a variable, why does it have to be an array?
> The parameter to -X is just a string.

Because -Y replaces a list; it's natural to generate the replacement
list as an array.  As with literal arrays (quoted below), I'd quite
like to alter get_user_var() to turn a scalar into a single element
array, which will solve this problem quite neatly, it just wasn't
a necessary part of yesterday's patch.  I certainly agree it's
desirable.

> If you're going to substitute a string, why pass it around with $reply?

I don't understand this.  The $reply comes only from the function.
The exact $reply array is used for the listing.  There is no more
substitution and $reply has always been for communication back from
functions. Do you mean `why not use $REPLY'?  The answer is because
you can't replace a complete listing with that.  It seems silly
to use both.

In more abstract terms, what gets displayed in a completion listing
is always an array of possibilities.  The whole point of the -Y option
is to allow you to alter that.  It is entirely natural that this altered
list would be an array.  It just so happens you can get away with a one
element array with everything stuck together, if you want.

> } Another thing under the `could perhaps be better, but it's time I did
> } some work' heading:  literal arrays are allowed as with -k, i.e. -Y
> } '(option1 option2 ...)', but there's no way of getting a literal
> } string there.
> 
> Why do you need to pass a literal string to -Y when you can use -X ?

You can't, not for the same thing.  See above.  -X and -Y are
entirely different:  -X gives a single, fixed banner heading for
the listing and for the completion; -Y gives a list of completions
to replace the ones shown when displaying completions.

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, Platanenallee 6, 15738 Zeuthen, Germany.


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

* PATCH: allow scalars as completion variables
  1997-11-20  9:22   ` Peter Stephenson
@ 1997-11-20 13:39     ` Peter Stephenson
  1997-11-20 16:57     ` User-defined completion listing Bart Schaefer
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Stephenson @ 1997-11-20 13:39 UTC (permalink / raw)
  To: Zsh hackers list, zsh

Peter Stephenson wrote:
> "Bart Schaefer" wrote:
> > If you're going to expand a variable, why does it have to be an array?
> > The parameter to -X is just a string.
> 
> Because -Y replaces a list; it's natural to generate the replacement
> list as an array.  As with literal arrays (quoted below), I'd quite
> like to alter get_user_var() to turn a scalar into a single element
> array, which will solve this problem quite neatly, it just wasn't
> a necessary part of yesterday's patch.  I certainly agree it's
> desirable.

Here's the corresponding patch:  with this, any of the usual uses of
variables within completion (including "reply") will allow a scalar,
which is turned internally into a one-element array.  I didn't implement
my other suggestion because it was treated with scorn.  This will work
independently of the -Y patch, apart from the manual entry.

(And I've finally updated my signature.  I was waiting for an account
here, but doomsday's a long way off at the moment, so if it looks oddly
international, that's why.)

*** Doc/Zsh/compctl.yo.YoY2	Wed Nov 19 17:34:51 1997
--- Doc/Zsh/compctl.yo	Thu Nov 20 14:29:42 1997
***************
*** 365,372 ****
  The list provided by var(func-or-var) is displayed instead of the list
  of completions whenever a listing is required; the actual completions
  to be inserted are not affected.  It can be provided in two
! ways. Firstly, if var(func-or-var) begins with a tt($) it defines an
! array variable, or if it begins with a left parenthesis a literal
  array, which contains the list.  A variable may have been set by a
  call to a function using the tt(-K) option.  Otherwise it contains the
  name of a function which will be executed to create the list.  The
--- 365,372 ----
  The list provided by var(func-or-var) is displayed instead of the list
  of completions whenever a listing is required; the actual completions
  to be inserted are not affected.  It can be provided in two
! ways. Firstly, if var(func-or-var) begins with a tt($) it defines a
! variable, or if it begins with a left parenthesis a literal
  array, which contains the list.  A variable may have been set by a
  call to a function using the tt(-K) option.  Otherwise it contains the
  name of a function which will be executed to create the list.  The
***************
*** 376,383 ****
  only be retrieved after a complete list of matches has been created.
  
  Note that the returned list does not have to correspond, even in
! length, to the original set of matches; the use of an array is purely
! a convenience for formatting.  No special formatting of characters is
  performed on the output in this case; in particular, newlines are
  printed literally and if they appear output in columns is suppressed.
  )
--- 376,383 ----
  only be retrieved after a complete list of matches has been created.
  
  Note that the returned list does not have to correspond, even in
! length, to the original set of matches, and may be passed as a scalar
! instead of an array.  No special formatting of characters is
  performed on the output in this case; in particular, newlines are
  printed literally and if they appear output in columns is suppressed.
  )
*** Src/Zle/zle_tricky.c.YoY2	Wed Nov 19 17:46:32 1997
--- Src/Zle/zle_tricky.c	Thu Nov 20 14:16:01 1997
***************
*** 3156,3164 ****
  	while ((*aptr++ = (char *)ugetnode(arrlist)));
  	uarr[count] = NULL;
  	return uarr;
!     } else
  	/* Otherwise it should be a parameter name. */
! 	return getaparam(nam);
  }
  
  /* This is strcmp with ignoring backslashes. */
--- 3156,3172 ----
  	while ((*aptr++ = (char *)ugetnode(arrlist)));
  	uarr[count] = NULL;
  	return uarr;
!     } else {
  	/* Otherwise it should be a parameter name. */
! 	char **arr = NULL, *val;
! 	if (!(arr = getaparam(nam)) && (val = getsparam(nam))) {
! 	    arr = (char *)ncalloc(2*sizeof(char *));
! 	    arr[0] = val;
! 	    arr[1] = NULL;
! 	}
! 	return arr;
!     }
! 
  }
  
  /* This is strcmp with ignoring backslashes. */

-- 
Peter Stephenson <pws@ifh.de>       Tel: +39 50 911239
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica Teorica
Piazza Torricelli 2, 56100 Pisa, Italy


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

* Re: User-defined completion listing
  1997-11-20  9:22   ` Peter Stephenson
  1997-11-20 13:39     ` PATCH: allow scalars as completion variables Peter Stephenson
@ 1997-11-20 16:57     ` Bart Schaefer
  1997-11-21  9:26       ` Peter Stephenson
  1 sibling, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 1997-11-20 16:57 UTC (permalink / raw)
  To: Peter Stephenson, Zsh hackers list

On Nov 20, 10:22am, Peter Stephenson wrote:
} Subject: Re: User-defined completion listing
}
} "Bart Schaefer" wrote:
} > }   compctl ... -Y '$array'
} > } or
} > }   compctl ... -Y 'func'
} > 
} > I must confess confusion as to why you'd do it this way.
} 
} We want something to be displayed instead of a listing.

Oh!  *I* didn't want something displayed instead of a listing; I just
wanted to be able to dynamically change the explanation.  It didn't
sink in exactly what it was you were implementing.

Given that, it all makes *much* more sense to me.

On Nov 20,  2:39pm, Peter Stephenson wrote:
} I didn't implement my other suggestion because it was treated with scorn.

I hope it wasn't me you thought was treating your suggestion with scorn.
That wasn't my intention; I was just trying to find out why you chose the
implementation you did, but starting from a misunderstanding of what it
was accomplishing.  Sorry.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: User-defined completion listing
  1997-11-20 16:57     ` User-defined completion listing Bart Schaefer
@ 1997-11-21  9:26       ` Peter Stephenson
  1997-11-21 18:39         ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Stephenson @ 1997-11-21  9:26 UTC (permalink / raw)
  To: Zsh hackers list

"Bart Schaefer" wrote:
> Oh!  *I* didn't want something displayed instead of a listing; I just
> wanted to be able to dynamically change the explanation.  It didn't
> sink in exactly what it was you were implementing.

Aha, I was thinking of the `jobs' example, which does seem to
be asking for the list of possiblities to be altered (though
if you don't mind the list of numbers at the end you could do it
that way, too).  It's easy to get -X to substitute a variable, too,
when it has a $ in front, but maybe it would be preferable to have
double-quoted expansion instead?  That might break some older explanations.

-- 
Peter Stephenson <pws@ifh.de>       Tel: +39 50 911239
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy


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

* Re: User-defined completion listing
  1997-11-21  9:26       ` Peter Stephenson
@ 1997-11-21 18:39         ` Bart Schaefer
  1997-11-27 10:10           ` PATCH: completion lists revisted Peter Stephenson
  0 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 1997-11-21 18:39 UTC (permalink / raw)
  To: Zsh hackers list

On Nov 21, 10:26am, Peter Stephenson wrote:
} Subject: Re: User-defined completion listing
}
} ...  It's easy to get -X to substitute a variable, too,
} when it has a $ in front, but maybe it would be preferable to have
} double-quoted expansion instead?

My suggestion had been that -X would stay as it is, but -Y would do the
double-quote expansion.  I'd pick some other letter for alteration of
the listing ... what else is not taken yet?  h, i, M, t, V, W, and y.

Good grief, that means there are 44 options to compctl right now (45 if
you count Peter's -Y), plus all the pattern-matching tags for -x.  Eek.

Anyway, I guess I'd go with -Y and one of -y or -W for what we're talking
about now.  Doesn't really matter which means which.  Or you could do all
three; use -y and -Y like -k and -K, except for modifying the listing,
and use -W as an expanding -X.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* PATCH: completion lists revisted
  1997-11-21 18:39         ` Bart Schaefer
@ 1997-11-27 10:10           ` Peter Stephenson
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Stephenson @ 1997-11-27 10:10 UTC (permalink / raw)
  To: zsh-workers, zsh

"Bart Schaefer" wrote:
> Anyway, I guess I'd go with -Y and one of -y or -W for what we're talking
> about now.  Doesn't really matter which means which.  Or you could do all
> three; use -y and -Y like -k and -K, except for modifying the listing,
> and use -W as an expanding -X.

Here's the complete thing, incorporating the earlier patches: -y
replaces the list for display with something returned from a function
or variable, -Y does expansion on the explanation string.  (-W was
already taken up with the patch for `with-directory', i.e. `-W ~/Mail
-f' completes files and paths under ~/Mail; you need that patch for a
clean application of this one, although they are functionally
independent.)

-y is handled first, so you can change variables for -Y:  a useless
example is:

fn() {
  reply=();
  local line
  if (( $# )); then
    expl="Select a file from the list"
    ls -fld $*| while read line; do reply=($reply $line); done
    (( $# == 1 ))  && expl="Unique completion\!"
  fi
}
compctl -f -y fn -Y '$expl' foo

(The only real point of using both at once is that the formatting is
done differently for the explanation and the completion list.)

I changed one additional piece of logic: the mere presence of an
explanation string used to force alternative completions not to be
tried.  For example,

compctl -k '(foo bar)' -X 'Yeah.' + -k '(Foo Bar)' foo

would never look at the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7;\VF*J7$Q.\(%WLY.)M"8M")G2S:95FE]P0DCHT*0TOV@P]
M^A^2(#%YB?>)@;(9WFT%):E;TGK&::[_XQR_CL>.]0P+(%FZPFD[MOOZ(K"\
M!DMO($RU[869#M\:G*KJ(U!QM:6-"#OB>>907[+SCV3'I4C6HHY"@9KY,CVT
MD=7#IPI_'PVAU5#]/K*(8W3;,GVL]$"1\#?4(["'A^UVRJM>/=S.J9IE0'RD
MMT@YS\,1BE;5#(8>8X6&'_1..X;'O$^)*"=DEHQ:/X@>QD6"ZQ"2NTJGO`ZH
MCK4[U9;'YBA%&A_U`__=[L$V,^)@\7.\M:M`*[9OEA[:*A+[B>7'57+:&)A8
MP67+5O8O*6$4]=5ZI<S/R:=5`:,9N+5\:=&X6F?3]^^%#I!58KV]B-$:^8):
MIK59R+2L*L8J=$PETVHJ8UH?JV%:#05,5?=4+Y2^WA,_JH"6\H2/BKZJ951<
M^J06;JUOE-M\?I73LMW`%L2M9<ZG15,O=<CE?E&]T]A$'0Y[T!@/AV8JCEA5
M7`(AZ]N7=$1?50U\1=/(UKZAB7!!651])>'H")X:$MDJWOCX]M!?ONJ^?@4;
M7O-EI<'P",@9CLQUI<\GIU:$\#N%95GDG%"PJE`OC&FIZ-<I'/-C#G/5R_1?
,F\7_`%H`3-[H/P``
`
end

-- 
Peter Stephenson <pws@ifh.de>       Tel: +39 50 911239
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy


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

* Re:  PATCH: completion lists revisted
@ 1997-11-27 10:34 Sven Wischnowsky
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Wischnowsky @ 1997-11-27 10:34 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> ...
> 
> I changed one additional piece of logic: the mere presence of an
> explanation string used to force alternative completions not to be
> tried.  For example,
> 
> compctl -k '(foo bar)' -X 'Yeah.' + -k '(Foo Bar)' foo
> 
> would never look at the Foo Bar possibilities (`foo F^D' would just
> mindlessly say `Yeah.').  Maybe someone can explain this.
> 

I guess this is just a bug (at least I can't remember implementing it
this way intentionally and this was probably my code).


Bye
 Sven


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


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

end of thread, other threads:[~1997-11-27 10:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-19 17:00 PATCH: User-defined completion listing Peter Stephenson
1997-11-19 19:41 ` Bart Schaefer
1997-11-20  9:22   ` Peter Stephenson
1997-11-20 13:39     ` PATCH: allow scalars as completion variables Peter Stephenson
1997-11-20 16:57     ` User-defined completion listing Bart Schaefer
1997-11-21  9:26       ` Peter Stephenson
1997-11-21 18:39         ` Bart Schaefer
1997-11-27 10:10           ` PATCH: completion lists revisted Peter Stephenson
1997-11-27 10:34 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).