zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>,
	zsh-users@sunsite.auc.dk
Subject: Re: Getting completion to tell the user what to do
Date: Tue, 20 Jul 1999 08:53:51 +0000	[thread overview]
Message-ID: <990720085351.ZM3390@candle.brasslantern.com> (raw)
In-Reply-To: <199907200708.JAA00727@beta.informatik.hu-berlin.de>

On Jul 20,  9:08am, Sven Wischnowsky wrote:
} Subject: Re: Getting completion to tell the user what to do
}
} Bart Schaefer wrote:
} 
} > What I want is to offer no completions at all [...]
} > but print a hint to the user as to what he's supposed to type.
} > 
} > What obvious thing have I forgotten/overlooked here?  Is there an entirely
} > better alternative to using compadd -X ?
} 
} Time for dirty tricks:
} 
}   compadd -UX 'Please...' -n ''
}   compstate[insert]=''

Oho -- undocumented dirty tricks, no less.  The compstate[insert] doc
doesn't give any hint that it can be set but empty.  Of which case that
is documented is this a degenerate?

}   compstate[list]=list
}   compstate[force_list]=yes
} 
} You need the -U because otherwise the empty string never matches
} what's on the line (not even the empty string on the line).

Really?  When I first tried

	compadd -X 'Please ...' ''

(without the -S) then every time I pressed TAB a single space got inserted
(the suffix).  If the empty string isn't a match, why did that happen?

} Then we can switch off insertion completely.

So that's what compstate[insert]='' means?

} If you want the string to be listed only on a TAB with an empty string 
} you can do `compadd -X "Please..." -n dummy' -- i.e. add a string with 
} matching.

Presumably then "dummy" should be something that can't possibly match?
Or does that not matter?

} The -n, of course, is just to be sure that the matches are not visible.
} 
} Is that good enough?

It's just marvelous, thanks.  One question, though -- I thought that we
made kill-whole-line erase the completion listing, but it doesn't seem to
do that in this case:

    zagzig% mail -s <TAB><C-u>

leaves me with

    zagzig% 
    Please enter a descriptive subject

which is rather annoying when I start in typing some completely different
command and doing completions for it that don't themselves produce a list.

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


  reply	other threads:[~1999-07-20  8:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-20  7:08 Sven Wischnowsky
1999-07-20  8:53 ` Bart Schaefer [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-07-20  9:16 Sven Wischnowsky
1999-07-19 17:38 Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=990720085351.ZM3390@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=wischnow@informatik.hu-berlin.de \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).