zsh-workers
 help / color / mirror / code / Atom feed
* compctl -X
@ 1997-02-19 15:57 Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 1997-02-19 15:57 UTC (permalink / raw)
  To: Zsh hackers list

Zoltan fixed compctl -X some time ago, but I think there's still
something wrong:  it works when listing but when actually completing
it prints the explanation only if the completion failed --- surely it
should print it only if the completion succeded?  You don't want to
be told `Doing completion X, 0 matches' when the completion mechanism
is trying something else, you want to be told when it *has* found
something according to that rule and is therefore inserting the
result.  (I should have woken up to this earlier, sorry.)

*** Src/Zle/zle_tricky.c.expl	Wed Feb 19 16:37:40 1997
--- Src/Zle/zle_tricky.c	Wed Feb 19 16:37:47 1997
***************
*** 2123,2129 ****
  	}
  
  	/* Print the explanation string if needed. */
! 	if (!showinglist && expl && !nmatches) {
  	    int up;
  
  	    feep();
--- 2123,2129 ----
  	}
  
  	/* Print the explanation string if needed. */
! 	if (!showinglist && expl && nmatches) {
  	    int up;
  
  	    feep();

-- 
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, 15735 Zeuthen, Germany.


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

* Re: compctl -X
  1997-08-05  6:47 ` Zoltan Hidvegi
@ 1997-08-05  7:52   ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 1997-08-05  7:52 UTC (permalink / raw)
  To: Zsh hackers list

Zoltan Hidvegi wrote:
> If there is a unique completion, do it and do
> not disturb the user.  If there are no or more than one completions,
> explain.

hmm, that's not how I use it:  I want to know where a completion or
completion list has come from when there are no visual cues, so that
I know, for example, that the list or single completion found does
not come from an existing file, any time one or more completions
were found.  It looks like another flag is required for this.

It means the manual entry I wrote is rather confusing, too.

*** Doc/Zsh/compctl.yo~	Fri Apr 25 06:37:27 1997
--- Doc/Zsh/compctl.yo	Tue Aug  5 09:49:45 1997
***************
*** 270,281 ****
  the empty string all words are taken (as with `tt(*)').  A typical
  use is
  
! nofill(tt(compctl -D -f PLUS() -H 0 '' -X '(No file found; using history)'))
  
  which forces completion to look back in the history list for a word if
! no filename matches.  The explanation string is useful as it tells
! the user that no file of that name exists, which is otherwise
! ambiguous. (See the next section for tt(-X)).
  )
  enditem()
  texinode(Control Flags)()(Flags with Arguments)(Option Flags)
--- 270,279 ----
  the empty string all words are taken (as with `tt(*)').  A typical
  use is
  
! nofill(tt(compctl -D -f PLUS() -H 0 ''))
  
  which forces completion to look back in the history list for a word if
! no filename matches.
  )
  enditem()
  texinode(Control Flags)()(Flags with Arguments)(Option Flags)
***************
*** 346,351 ****
--- 344,351 ----
  item(tt(-X) var(explanation))(
  Print var(explanation) when trying completion on the current set of
  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.
  )
  enditem()
  texinode(Alternative Completion)(Extended Completion)(Option Flags)(Programmable Completion)

-- 
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] 4+ messages in thread

* Re: compctl -X
  1997-08-04 16:35 Peter Stephenson
@ 1997-08-05  6:47 ` Zoltan Hidvegi
  1997-08-05  7:52   ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Zoltan Hidvegi @ 1997-08-05  6:47 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

> I sent this some time ago, it seems to have disappeared...
> 
> `compctl -X explanation' should print the explanation if there *are*
> matching completions, not if there aren't.  If the type of matching
> wasn't used, you don't care; if it was, you want to know why.

It depends how do you use compctl -X.  I used in in exatly the opposite
way: for example for dd, I complete filenames after if= but when I hit
TAB after bs= zsh will print <number> (see Misc/compctl-examples), and
that's always worked at least since zsh-2.5.  Older versions had an
nmatches != 1 test here: if there is a unique completion, do it and do
not disturb the user.  If there are no or more than one completions,
explain.  It was an oversight from me (that I made last August, almost a
year ago) to change it.  The patch below restores the original behaviour.

Zoltan


*** Src/Zle/zle_tricky.c	1997/06/16 05:20:01	3.1.3.1
--- Src/Zle/zle_tricky.c	1997/08/05 06:35:44
***************
*** 2127,2136 ****
  	}
  
  	/* Print the explanation string if needed. */
! 	if (!showinglist && expl && !nmatches) {
  	    int up;
  
! 	    feep();
  	    trashzle();
  
  	    clearflag = (isset(USEZLE) && !termflags &&
--- 2127,2137 ----
  	}
  
  	/* Print the explanation string if needed. */
! 	if (!showinglist && expl && nmatches != 1) {
  	    int up;
  
! 	    if (!nmatches)
! 		feep();
  	    trashzle();
  
  	    clearflag = (isset(USEZLE) && !termflags &&


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

* compctl -X
@ 1997-08-04 16:35 Peter Stephenson
  1997-08-05  6:47 ` Zoltan Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 1997-08-04 16:35 UTC (permalink / raw)
  To: Zsh hackers list

I sent this some time ago, it seems to have disappeared...

`compctl -X explanation' should print the explanation if there *are*
matching completions, not if there aren't.  If the type of matching
wasn't used, you don't care; if it was, you want to know why.

*** Src/Zle/zle_tricky.c.minusX	Mon Jul 14 11:44:47 1997
--- Src/Zle/zle_tricky.c	Fri Aug  1 14:16:33 1997
***************
*** 2128,2134 ****
  	}
  
  	/* Print the explanation string if needed. */
! 	if (!showinglist && expl && !nmatches) {
  	    int up;
  
  	    feep();
--- 2128,2134 ----
  	}
  
  	/* Print the explanation string if needed. */
! 	if (!showinglist && expl && nmatches) {
  	    int up;
  
  	    feep();

-- 
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] 4+ messages in thread

end of thread, other threads:[~1997-08-05  8:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-02-19 15:57 compctl -X Peter Stephenson
1997-08-04 16:35 Peter Stephenson
1997-08-05  6:47 ` Zoltan Hidvegi
1997-08-05  7:52   ` 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).