zsh-workers
 help / Atom feed
* How to disable completion for a builtin? (actually a reserved word) + an apparent bug
@ 2019-07-24 14:18 ` Sebastian Gniazdowski
  2019-07-24 14:27   ` Peter Stephenson
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-24 14:18 UTC (permalink / raw)
  To: Zsh hackers list

Hello,
I would like to disable the completion for the declare builtin. How to
accomplish this?

A side-note: disabling declare doesn't help. Also, it's actually
impossible to disable the command (it will still work), probably
because it's a reserved-word, not (only) a builtin. I wonder, couldn't
the disable effect be emulated in this case? Because from user's point
of view, declare is a typical builtin so disable should work, what is
also suggested by the disable command returning no errors.

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

* Re: How to disable completion for a builtin? (actually a reserved word) + an apparent bug
  2019-07-24 14:18 ` How to disable completion for a builtin? (actually a reserved word) + an apparent bug Sebastian Gniazdowski
@ 2019-07-24 14:27   ` Peter Stephenson
  2019-07-24 14:56     ` Sebastian Gniazdowski
  2019-07-24 15:02     ` Sebastian Gniazdowski
  0 siblings, 2 replies; 10+ messages in thread
From: Peter Stephenson @ 2019-07-24 14:27 UTC (permalink / raw)
  To: zsh-workers

On Wed, 2019-07-24 at 16:18 +0200, Sebastian Gniazdowski wrote:
> Hello,
> I would like to disable the completion for the declare builtin. How to
> accomplish this?

unset '_comps[declare]'

pws

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

* Re: How to disable completion for a builtin? (actually a reserved word) + an apparent bug
  2019-07-24 14:27   ` Peter Stephenson
@ 2019-07-24 14:56     ` Sebastian Gniazdowski
  2019-07-24 15:02     ` Sebastian Gniazdowski
  1 sibling, 0 replies; 10+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-24 14:56 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

On Wed, 24 Jul 2019 at 16:28, Peter Stephenson <p.stephenson@samsung.com> wrote:
>
> On Wed, 2019-07-24 at 16:18 +0200, Sebastian Gniazdowski wrote:
> > Hello,
> > I would like to disable the completion for the declare builtin. How to
> > accomplish this?
>
> unset '_comps[declare]'

Ah, right, I've forgot about it. Thanks!

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

* Re: How to disable completion for a builtin? (actually a reserved word) + an apparent bug
  2019-07-24 14:27   ` Peter Stephenson
  2019-07-24 14:56     ` Sebastian Gniazdowski
@ 2019-07-24 15:02     ` Sebastian Gniazdowski
  2019-07-24 15:15       ` Peter Stephenson
  1 sibling, 1 reply; 10+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-24 15:02 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

On Wed, 24 Jul 2019 at 16:28, Peter Stephenson <p.stephenson@samsung.com> wrote:
>
> On Wed, 2019-07-24 at 16:18 +0200, Sebastian Gniazdowski wrote:
> > Hello,
> > I would like to disable the completion for the declare builtin. How to
> > accomplish this?
>
> unset '_comps[declare]'

Actually that's not what I've meant. I've should have put this more
clearly: how to prevent command `declare' from being completed? Like
if chmod -x /usr/bin/declare?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

* Re: How to disable completion for a builtin? (actually a reserved word) + an apparent bug
  2019-07-24 15:02     ` Sebastian Gniazdowski
@ 2019-07-24 15:15       ` Peter Stephenson
  2019-07-24 15:39         ` Sebastian Gniazdowski
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Stephenson @ 2019-07-24 15:15 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh hackers list

On Wed, 2019-07-24 at 17:02 +0200, Sebastian Gniazdowski wrote:
> On Wed, 24 Jul 2019 at 16:28, Peter Stephenson <p.stephenson@samsung.com> wrote:
> > 
> > 
> > On Wed, 2019-07-24 at 16:18 +0200, Sebastian Gniazdowski wrote:
> > > 
> > > Hello,
> > > I would like to disable the completion for the declare builtin. How to
> > > accomplish this?
> > unset '_comps[declare]'
> Actually that's not what I've meant. I've should have put this more
> clearly: how to prevent command `declare' from being completed? Like
> if chmod -x /usr/bin/declare?

Either you have a special completion, or it does default completion.
If you don't want default completion, you need a compdef for a do-nothing
completion function.

pws


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

* Re: How to disable completion for a builtin? (actually a reserved word) + an apparent bug
  2019-07-24 15:15       ` Peter Stephenson
@ 2019-07-24 15:39         ` Sebastian Gniazdowski
  2019-07-24 15:48           ` Peter Stephenson
  2019-07-24 19:50           ` Eric Cook
  0 siblings, 2 replies; 10+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-24 15:39 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

śr., 24 lip 2019, 17:15 użytkownik Peter Stephenson <
p.stephenson@samsung.com> napisał:

> On Wed, 2019-07-24 at 17:02 +0200, Sebastian Gniazdowski wrote:
> > On Wed, 24 Jul 2019 at 16:28, Peter Stephenson <p.stephenson@samsung.com>
> wrote:
> > >
> > >
> > > On Wed, 2019-07-24 at 16:18 +0200, Sebastian Gniazdowski wrote:
> > > > accomplish this?
> > > unset '_comps[declare]'
> > Actually that's not what I've meant. I've should have put this more
> > clearly: how to prevent command `declare' from being completed? Like
> > if chmod -x /usr/bin/declare?
>
> Either you have a special completion, or it does default completion.
> If you don't want default completion, you need a compdef for a do-nothing
> completion function.
>
> pws
>

I don't want to change disable's completion. What I want is that:

% decl<TAB>

will not try to complete "declare".

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

* Re: How to disable completion for a builtin? (actually a reserved word) + an apparent bug
  2019-07-24 15:39         ` Sebastian Gniazdowski
@ 2019-07-24 15:48           ` Peter Stephenson
  2019-07-24 15:59             ` Sebastian Gniazdowski
  2019-07-24 19:50           ` Eric Cook
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Stephenson @ 2019-07-24 15:48 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh hackers list

On Wed, 2019-07-24 at 17:39 +0200, Sebastian Gniazdowski wrote:
> śr., 24 lip 2019, 17:15 użytkownik Peter Stephenson <p.stephenson@samsung.com> napisał:
> > On Wed, 2019-07-24 at 17:02 +0200, Sebastian Gniazdowski wrote:
> > > On Wed, 24 Jul 2019 at 16:28, Peter Stephenson <p.stephenson@samsung.com> wrote:
> > > > 
> > > > 
> > > > On Wed, 2019-07-24 at 16:18 +0200, Sebastian Gniazdowski wrote:
> > > > > accomplish this?
> > > > unset '_comps[declare]'
> > > Actually that's not what I've meant. I've should have put this more
> > > clearly: how to prevent command `declare' from being completed? Like
> > > if chmod -x /usr/bin/declare?
> > 
> > Either you have a special completion, or it does default completion.
> > If you don't want default completion, you need a compdef for a do-nothing
> > completion function.
> > 
> > pws
> I don't want to change disable's completion. What I want is that:
> 
> % decl<TAB>
> 
> will not try to complete "declare".

declare is usually a builtin.  If you disabled that it should
remove it from the list of enabled builtins and reserved words
and it won't complete.

disable -r declare
disable declare

(they're different because the reserved word needs to do
special parsing for arrays that an ordinary builtin doesn't.)

If you really have an external command called declare, remove
it from the hash table:

unhash declare

pws


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

* Re: How to disable completion for a builtin? (actually a reserved word) + an apparent bug
  2019-07-24 15:48           ` Peter Stephenson
@ 2019-07-24 15:59             ` Sebastian Gniazdowski
  0 siblings, 0 replies; 10+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-24 15:59 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

On Wed, 24 Jul 2019 at 17:48, Peter Stephenson <p.stephenson@samsung.com> wrote:
>
> On Wed, 2019-07-24 at 17:39 +0200, Sebastian Gniazdowski wrote:
> > I don't want to change disable's completion. What I want is that:
> >
> > % decl<TAB>
> >
> > will not try to complete "declare".
>
> declare is usually a builtin.  If you disabled that it should
> remove it from the list of enabled builtins and reserved words
> and it won't complete.
>
> disable -r declare
> disable declare

Ah, didn't expect that declare can disable reserved words. Thanks!

> (they're different because the reserved word needs to do
> special parsing for arrays that an ordinary builtin doesn't.)

Good to know.
-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

* Re: How to disable completion for a builtin? (actually a reserved word) + an apparent bug
  2019-07-24 15:39         ` Sebastian Gniazdowski
  2019-07-24 15:48           ` Peter Stephenson
@ 2019-07-24 19:50           ` Eric Cook
  2019-07-25  8:58             ` Sebastian Gniazdowski
  1 sibling, 1 reply; 10+ messages in thread
From: Eric Cook @ 2019-07-24 19:50 UTC (permalink / raw)
  To: zsh-workers

On 7/24/19 11:39 AM, Sebastian Gniazdowski wrote:
>
> I don't want to change disable's completion. What I want is that:
>
> % decl<TAB>
>
> will not try to complete "declare".
>

zstyle :completion::complete:-command-::commands ignored-patterns declare

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

* Re: How to disable completion for a builtin? (actually a reserved word) + an apparent bug
  2019-07-24 19:50           ` Eric Cook
@ 2019-07-25  8:58             ` Sebastian Gniazdowski
  0 siblings, 0 replies; 10+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-25  8:58 UTC (permalink / raw)
  To: Eric Cook; +Cc: Zsh hackers list

On Thu, 25 Jul 2019 at 02:49, Eric Cook <llua@gmx.com> wrote:
>
> On 7/24/19 11:39 AM, Sebastian Gniazdowski wrote:
> >
> > I don't want to change disable's completion. What I want is that:
> >
> > % decl<TAB>
> >
> > will not try to complete "declare".
> >
>
> zstyle :completion::complete:-command-::commands ignored-patterns declare

A perfect solution. I was about to double (in a plugin) the _*
function responsible for doing the commands completion and apply a
filter there, and now I don't have to.
-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

end of thread, back to index

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190724141945epcas1p30d69e2d7ba1ce29f994ff486284d4553@epcas1p3.samsung.com>
2019-07-24 14:18 ` How to disable completion for a builtin? (actually a reserved word) + an apparent bug Sebastian Gniazdowski
2019-07-24 14:27   ` Peter Stephenson
2019-07-24 14:56     ` Sebastian Gniazdowski
2019-07-24 15:02     ` Sebastian Gniazdowski
2019-07-24 15:15       ` Peter Stephenson
2019-07-24 15:39         ` Sebastian Gniazdowski
2019-07-24 15:48           ` Peter Stephenson
2019-07-24 15:59             ` Sebastian Gniazdowski
2019-07-24 19:50           ` Eric Cook
2019-07-25  8:58             ` Sebastian Gniazdowski

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/ public-inbox