zsh-workers
 help / color / mirror / code / Atom feed
* "show" completion et al spammy when binaries don't exist
@ 2008-01-12 20:57 Mikael Magnusson
  2008-01-14  9:49 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2008-01-12 20:57 UTC (permalink / raw)
  To: zsh-workers

I was looking at another window while writing and typed
show show gi<tab>
instead of git show gi<tab> and got the following:
% show show gi_mh:1: command not found: mhpath
_mh:1: command not found: mhparam
_mh:1: command not found: mhpath
_mh:1: command not found: mhparam
_mh:1: command not found: mhpath
_mh:1: command not found: mhparam
_mh:1: command not found: mhpath
_mh:1: command not found: mhparam
                           show show gi<cursor here>
---- no match for: `sequence' or `corrections'

After the error messages the prompt wasn't redrawn correctly, but I
think that is expected. In _mh all commands are called with 2>
/dev/null, but that doesn't help much since zsh is the one to print
the messages. Which leads me to ask, is the stderr output of
completion scripts ever wanted in the terminal? Maybe it should be
redirected more centrally? Putting
which mhpath >& /dev/null || return
on the first line of _mh fixes the problem, I don't know if some other
method would be preferred. It seems _git also suffers from this
problem. Typing apt-get install <tab> repeatedly inserts a space. Are
these sort of things to be considered as problems, or am I stupid to
press tab after a command I don't have?

-- 
Mikael Magnusson


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

* Re: "show" completion et al spammy when binaries don't exist
  2008-01-12 20:57 "show" completion et al spammy when binaries don't exist Mikael Magnusson
@ 2008-01-14  9:49 ` Peter Stephenson
  2008-01-14 16:11   ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2008-01-14  9:49 UTC (permalink / raw)
  To: zsh-workers

On Sat, 12 Jan 2008 21:57:35 +0100
"Mikael Magnusson" <mikachu@gmail.com> wrote:
> I was looking at another window while writing and typed
> show show gi<tab>
> instead of git show gi<tab> and got the following:
> % show show gi_mh:1: command not found: mhpath
> _mh:1: command not found: mhparam
> _mh:1: command not found: mhpath
> _mh:1: command not found: mhparam
> _mh:1: command not found: mhpath
> _mh:1: command not found: mhparam
> _mh:1: command not found: mhpath
> _mh:1: command not found: mhparam
>                            show show gi<cursor here>
> ---- no match for: `sequence' or `corrections'
> 
> After the error messages the prompt wasn't redrawn correctly, but I
> think that is expected. In _mh all commands are called with 2>
> /dev/null, but that doesn't help much since zsh is the one to print
> the messages. Which leads me to ask, is the stderr output of
> completion scripts ever wanted in the terminal? Maybe it should be
> redirected more centrally? Putting
> which mhpath >& /dev/null || return
> on the first line of _mh fixes the problem, I don't know if some other
> method would be preferred.

Probably something like this.

Index: Completion/Unix/Command/_mh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_mh,v
retrieving revision 1.7
diff -u -r1.7 _mh
--- Completion/Unix/Command/_mh	9 Dec 2005 19:21:54 -0000	1.7
+++ Completion/Unix/Command/_mh	14 Jan 2008 09:48:34 -0000
@@ -1,5 +1,10 @@
 #compdef ali anno burst comp dist flist flists folder folders forw inc mark mhlist mhmail mhn mhparam mhpath mhshow mhstore msgchk next packf pick prev refile repl rmf rmm scan show sortm whom
 
+if [[ -z $commands[mhpath] ]]; then
+  _message "MH commands are not available"
+  return 1
+fi
+
 # Completion for all possible MH commands.
 local mymhdir=${$(_call_program mhpath mhpath + 2>/dev/null):-~/Mail}
 local mhlib=/usr/lib/mh


-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: "show" completion et al spammy when binaries don't exist
  2008-01-14  9:49 ` Peter Stephenson
@ 2008-01-14 16:11   ` Bart Schaefer
  2008-01-14 16:16     ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2008-01-14 16:11 UTC (permalink / raw)
  To: zsh-workers

On Jan 14,  9:49am, Peter Stephenson wrote:
} Subject: Re: "show" completion et al spammy when binaries don't exist
}
} On Sat, 12 Jan 2008 21:57:35 +0100
} "Mikael Magnusson" <mikachu@gmail.com> wrote:
} > Which leads me to ask, is the stderr output of
} > completion scripts ever wanted in the terminal? Maybe it should be
} > redirected more centrally?
} 
} Probably something like this.

That'll do it for MH, but I think he meant something more like changing
$_comp_setup from

	exec </dev/null
to
	exec </dev/null 2>>|$HOME/.zcomperror

(which I think would break _complete_debug so it probably needs more
thought than that).


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

* Re: "show" completion et al spammy when binaries don't exist
  2008-01-14 16:11   ` Bart Schaefer
@ 2008-01-14 16:16     ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2008-01-14 16:16 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:
> On Jan 14,  9:49am, Peter Stephenson wrote:
> That'll do it for MH, but I think he meant something more like changing
> $_comp_setup from
> 
> 	exec </dev/null
> to
> 	exec </dev/null 2>>|$HOME/.zcomperror
> 
> (which I think would break _complete_debug so it probably needs more
> thought than that).

I realize that was one of the suggestions, but I'm not convinced that's
the right way to go...  I think the right thing to do is to identify
those completions which produce output on standard error and fix them
appropriately.  Simply turning off the error messages gives you no clue
about why the completion has failed.  Even if the verbose messages
aren't directly useful to the end user, they give developers (who
need as much help as they can get) an inkling as to what needs fixing.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

end of thread, other threads:[~2008-01-14 16:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-12 20:57 "show" completion et al spammy when binaries don't exist Mikael Magnusson
2008-01-14  9:49 ` Peter Stephenson
2008-01-14 16:11   ` Bart Schaefer
2008-01-14 16:16     ` 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).